Forum Discussion
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.
- nisgupta7 years agoValued Contributor
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
- tristaanogre7 years agoEsteemed 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
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.
- nisgupta7 years agoValued Contributor
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
Related Content
- 9 years ago
Recent Discussions
- 2 days ago
- 7 days ago
- 11 days ago