Forum Discussion

Shirin's avatar
Shirin
New Contributor
5 years ago
Solved

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.

  • 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.

10 Replies

  • tristaanogre's avatar
    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

    • Shirin's avatar
      Shirin
      New Contributor

      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. 

       

      • tristaanogre's avatar
        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.

  • Marsha_R's avatar
    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/

    • Shirin's avatar
      Shirin
      New Contributor

      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. 

       

    • sonya_m's avatar
      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_m's avatar
        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.