How to set a global Base URL for every test case of one test suite in Selenium IDE?

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:
enter image description here

An example of a following test case.
enter image description here

Notice

  1. 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.

  2. that the Base Url becomes irrelevant. You’re overriding it, essentially.

I hope that’s helpful!

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)