0 votes
1 view
in Devops and Agile by (19.8k points)

How to set a global Base URL for every test case of one test suite in Selenium IDE so that I can switch to the different environments easily?

1 Answer

0 votes
by (63.4k points)

If you have a lot of test cases in a single suite, it might be difficult 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 to store https://testing.site.com/asmyEnvironment 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 the following test case. enter image description here

Note:

  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 it helps!

Welcome to Intellipaat Community. Get your technical queries answered by top developers !


Categories

...