Running the same test case in multiple environments

When you are building web sites and web applications you often have a number of environments in the release pipeline: DEV, TEST, PREPROD etc. Often the environments are similar in structure and behavior and the difference is the version of the software on the servers and the URL for the servers.

From a regression point of view it makes a lot of sense to run some or all the test cases against all the environment to ensure the quality. To run the same test case against different URLs, the URL needs to be a parameter to the individual test case, so it's possible to specify different URLs for different environments.

To add a parameter to a test case you can use a "Scheduled Variable". This is a variable that you can set in the definition of a schedule and that will be accessible to all test cases executed by the Schedule. Remember: a Schedule specifies that one or more test cases should run on one or more Environments.

To specify a "Scheduled Variable" open or create a new Schedule. On the Variables tab click "Create new" and enter a name for the variable and assign a value. E.g. name could be "URL" and the value could be "http://internal.test.dom".

Once the variable is defined it's available to all the test cases selected on the "Cases to run" tab. So to run the same test case(s) for multiple environments just create a Schedule for each environment, select the test cases and create a "URL" variable with a value matching the environment. This means you will end up having a number of Schedules - one for each environment.

To use the value from the URL variable, add a "Get variable" building block to the flow.

The "Get Variable" block will look up the value specified in the Schedule. If no variable is found with the specified name, the default value is used.