Forum Discussion

romanmfs's avatar
romanmfs
Frequent Contributor
7 years ago

Keyword Testing in different Environment

Hi!

 

We have 3 different environments ( QA, DEV and Production), where we test same website using simple keyword tests. I created 1 test for Production environment which runs successfully.

 

My problem is I do not want to "rerecord' everything since all 3 environments look the same other than that they have different URLs and different object names. So I tried to change the URL names for the new environment  and then I found out that I have to change every URL in Name Mapping which I did using the wildcard(*).  This is very time consuming and still doesn't properly work.

Can you guys please advise if there is a more proper way to do it. I am a beginner and do not know how to script.

Thank You!

4 Replies

  • tristaanogre's avatar
    tristaanogre
    Esteemed Contributor

    Well, the first step, as you noted, is to make sure that your mapping references the URL's with appropriate wildcards to account for environment.

     

    As for the rest... it would help to know what "still doesn't properly work".  Specifically, what errors are you getting, what keyword operations are generating the errors, etc.

     

    • nisgupta's avatar
      nisgupta
      Valued Contributor

      tristaanogre

       

      I am doing the same thing . I have used wild card in Name Mapping. In our case we have test and production environment. 

      But in my script I am launching the browser 

      Browsers.Item(btFirefox).Run(url) 

      i am providing the complete url if I want to run for testing environment. 

      Now I know I can run the same script for  production environment  but then I have to make change in the script - change the URL for production environment .

       

      Look like I have to create 2 scripts one for test and one for production with just one change in URL.

       

      IS there any other way to do this ?

       

      Thanks

      Nishchal

      • tristaanogre's avatar
        tristaanogre
        Esteemed Contributor

        What we do is, in our call to run the URL, the URL is not a hardcoded string.  We have a configuration variable in our project that indicates the "root" URL.  Say, for example, I want to run in the dev environment.  So, I have a variable that contains

         

        http://testapp.mydomain.com/

         

        that I set via my framework on start up of the tests.

         

        So, then, the URL that I pass to the Browsers.Item(btFireFox).Run() method is

         

        Browsers.Item(btnFirefox).Run(myVariable + '\mainpage\login.html')

         

        So, every time I want to change domain, I just change that one variable and the tests will run properly for the changed domain.  No need for having multiple sets of scripts, simply make the scripts more robust and dynamic to handle multiple environments.