How to set a global Base URL for every test case of one test suite in Selenium IDE so that I can switch to different environment easily?
The base URL should be the index of your site. NOT the directory under test. This will open http://google.com/search as the beginning Url. From then, you should continue testing.
Selenium IDE has add-ons for Firefox and Chrome browsers. Selenium IDE comes with a rich set of commands that are powered by Selenese and it allows you to record and test different interactions of a web application with the browser.
Open (URL) - Selenium IDE command Meet Open - the most used command in the selenium IDE software testing tool. The "Open" command opens the URL in the current selected browser tab. The open command takes a full URL as input (recommended) or a path relative to the baseurl (outdated).
If you have a lot of test cases in a single suite, it's a pain to change the Base URL for each. Instead, create a separate case for each Base URL you need to switch between. For example, I have store https://testing.site.com/
as myEnvironment
saved as test case SetEnvTesting. I create another case for my production site, SetEnvProduction.
Then, insert the ${myEnvironment}
at the beginning of each relative URL in your test cases. For example, open ${myEnvironment}/login.aspx
. (This might be a pain if you've got a lot of tests already. I suggest just adding it from now on.) Then, simply put the set-environment test case at the beginning of your test suite. To switch your entire suite to another Base URL, simply put a different set-environment case at the start. Another nice thing is that you can switch environments in the middle of the suite by putting a different set-environment case in the middle.
Edit: Example of using a SetEnvironment test case.
The SetEnvironment case:
An example of a following test case.
Notice
how the CurrentEnvironment variable is used. You can do this for every case in the suite. Additionally, you can make every separate test suite use this same SetEnvironment case, so they all switch together.
that the Base Url becomes irrelevant. You're overriding it, essentially.
I hope that's helpful!
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With