cancel
Showing results for 
Search instead for 
Did you mean: 

Keyword Testing in different Environment

Frequent Contributor

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 4
Community Hero

Re: Keyword Testing in different Environment

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.

 


Robert Martin
[Community Expert Group]
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
Extensions available
Super Contributor

Re: Keyword Testing in different Environment

@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

Community Hero

Re: Keyword Testing in different Environment

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.


Robert Martin
[Community Expert Group]
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
Extensions available
Super Contributor

Re: Keyword Testing in different Environment

@tristaanogre

Thank you for the updates . I am not sure how we can set up the config file. 

What I did is I created the Project Variable and set the URL there . 

Then I use the following code in the script

Browsers.Item(btFirefox).Run(Project.Variables.baseURL);

 

Do you think this will make scripts more flexible to handle in different environments.

 

Please advise 

Thanks

NG

 

 

New Here?
Join us and watch the welcome video:
Top Kudoed Authors