Forum Discussion

DarkShadows's avatar
DarkShadows
Contributor
8 years ago

How to make generic script

Hello Team, i'm new in to use TestComplete tools, however while doing some experiment on this tool what i observe that how we can maintain the main scripts across entire platform. i'm QA and working...
  • tristaanogre's avatar
    8 years ago

    As with any automation tool that automates based upon UI, what you enter in during recording is what is stored in the script created.  This includes URL's stored in NameMapping files, etc.  The general process is then, after recording, going back and editing scripts and NameMapping objects to be more generalized.

     

    For example, in our AUT, we have multiple environments as well with the same basic pages on each environment.  On one environment, the URL is something like http://testenvironment1.mycompany.com/mainsegment/mainpage.html.  On another environment, the URL is http://testenvironment2.mycompany.com/mainsegment/mainpage.html.  If I do the recording in the first environment, the URL gets entered in NameMapping as indicated above.  If I want it to be able to run against any environment, what I do is edit my namemapping so the URL for the page is "*/mainsegment/mainpage.html".  This will make the mapping work for any environment so long as the path and page in the URL remains the same.  This is what I suggest you do after your recording.  

     

    As a rule of thumb, for sustainable, maintainable, and reusable test automation, ALWAYS edit your recording after you're done recording.  The recording should never be used as the actual test to be run but should only be used to get you started.  Your validations, verifications, etc., should be added after the fact and the test should have wildcards, parameters, etc., applied in order to do precisely what you are asking.