how to change the url in a test case
Hello, I have been building a lot of test cases in local Env. Now I want to launch it against another environment. I just change the URL browser to a variable. The problem is when the test case is executing, launches the dev url. (It's inside somewhere in the namemappgin file) . How can I make changeable to a variable???
thanks.
You will need to change your namemappings because they likely have the URL in them.
For example your URL could be https://devenvironment.mycompany.com
This would be changed to https://*.mycompany.com
The * is a wild card.
In this way the scripts will work for any site as long as the rest of the URL is correct. You can then set a global variable for us in your scripts to open a broser to a particular URL.
In the past I have edited the NameMapping file in notepad++ and did a global find/replace. I recommend making a backup copy of the file before doing this.
Following threads help you make a dynamic URL property.
Thanks both of you. I am already changed the URL at page object in the namemappin. But this wont fix everything becuase inside some pages are hiperlinks with the url hardcoded, Is there any way to change all the URL at once?
Thanks.
No, You can't make it at one step.
But, You can try below steps,
1. Create project variable like environmentURL.
2. Store the URL with * appended in both sides like as "*te.env.com*"
3. Add this variable into all of your objects which has your URL.
Then you will be able to access the objects.
Note: Some objects mayhave unique URL to identify the page like te.env.com\testpage if you use above steps all pages treated in the sameway