Ask a Question

How To Videos? for scripting in TestComplete

SOLVED
Shirin
New Contributor

How To Videos? for scripting in TestComplete

Are there any videos or documentation on how to set up "Scripting" in Testcomplete? I've emailed Smartbear tech. support several times and no reply so was reaching out here. I use keyword testing and have tried the "Convert to script" feature but it's not really understandable code. I would like to try to use javascript or python and create a framework for testing web functionality. 
1. How can I set up a framework / project?

2. Where do I enter my code for web testing?

3. Where do I enter the locators for the links that I'm trying to "click", "set text", "clickbutton", etc?

Any guidance would be appreciated.

10 REPLIES 10
Marsha_R
Champion Level 3

1) Convert to script is exactly that - it converts your keyword test to the scripting language set in your project.  I use the javascript one all the time and it's quite readable.

 

2) From your other questions, it sounds like you are not familiar with TestComplete at all.  Here's a list of many free videos that will help you get started:

https://support.smartbear.com/screencasts/testcomplete/

tristaanogre
Esteemed Contributor

Just as a general note:

 

Keywords test and Script code are, basically, two ways of doing the same thing.  Keyword tests use a visual drag/drop interface of operations to perform actions for tests.  Script uses code for doing the same thing.  So, it's not like there's anything "special" about Script.

 

Now, using Script DOES allow you to do some fancier stuff like writing custom OO code for building automation frameworks, etc.  But that's just code work that supports creating tests.  So, to answer your questions:

 

1) In your project explorer, usually under "Advanced" is an item called "Scripts".  This is where you can see the list of existing script code units that are currently in your project.  You can add new script code units there and switch between units in your editor by double clicking on them.  So, if you want to write your own custom framework code, start there with creating code units

2) See #1.  Script code is script code.  It doesn't distinguish between Web or Desktop or Mobile. 

3) "Locators" I'm assuming is what you're calling the objects like Aliases.browser.MyPage.blah.  There is no difference between keywords tests and script except you have to type them out.

 

As @Marsha_R , you might benefit from some tutorials either in those screen casts she pointed out, registering for the TestComplete Acadmey free training, etc.  

 

As a side note -> The terms you are using (locaters for example) seem like you're used to using a different tool.  What tool have you used in the past?  Perhaps we can help translate what you're used to using into TestComplete terms


Robert Martin
[Hall of Fame]
Please consider giving a Kudo if I write good stuff
----

Why automate?  I do automated testing because there's only so much a human being can do and remain healthy.  Sleep is a requirement.  So, while people sleep, automation that I create does what I've described above in order to make sure that nothing gets past the final defense of the testing group.
I love good food, good books, good friends, and good fun.

Mysterious Gremlin Master
Vegas Thrill Rider
Extensions available
sonya_m
SmartBear Alumni (Retired)

Thank you everybody for answers!

 

Hi @Shirin , could you please provide the support ticket number where you didn't get an answer from the Support Team? I've looked through your support requests history and couldn't find any unanswered questions myself.

It is our highest priority to make sure that all customers get timely assistance, so I would like to investigate this futher, thank you.

 

 


Sonya Mihaljova
Community and Education Specialist

sonya_m
SmartBear Alumni (Retired)

@Shirin as for your quesion, we actually have great free learning courses at the SmartBear Academy, as well.

Feel free to enroll here

 

Also, you should check out TestComplete documentation for scripting. A lot of information there.

 

Do you need anymore assitance with this? Please let us know.


Sonya Mihaljova
Community and Education Specialist

Thanks for your reply. I will look into the videos link you attached. I am familiar with creating keyword test and using built in functionality like editing the namemapping and using code snippet. I'm trying to use scripting now and was reaching out for assistance. 

 

Robert,

Thank you for your reply. I've used "java" where you create locators for all the links and then create methods. Then you call the "method" as needed to automate. For the links, I used xpath, css and so on. 

 

With keywork testing, it's great because it creates the scripts and puts all links needed in namemapping. Now I've trying to use "javascript" to code. The aliases.browser.mypage... etc, gets very random and I'm trying to create my own links or locators if possible. I'll start with the videos and see if it helps. 

 

Shirin
New Contributor

Sonya,

 

Please email me your email and I will send you details.

 

Thanks

tristaanogre
Esteemed Contributor

The "random" nature of the Aliases is due to the automatic mapping that TestComplete is doing.  When you record or select to perform an on screen action and then select the onscreen object, it creates an entry in NameMapping.  Something that a lot of people here have mentioned as a general best practice is to deliberately map components you're going to use for automation ahead of time.  This allows you greater control over the mapping naming, properties used, etc.


Robert Martin
[Hall of Fame]
Please consider giving a Kudo if I write good stuff
----

Why automate?  I do automated testing because there's only so much a human being can do and remain healthy.  Sleep is a requirement.  So, while people sleep, automation that I create does what I've described above in order to make sure that nothing gets past the final defense of the testing group.
I love good food, good books, good friends, and good fun.

Mysterious Gremlin Master
Vegas Thrill Rider
Extensions available
cancel
Showing results for 
Search instead for 
Did you mean: