Have you ever wondered how to run the same test with different URLs?
Did you want to run your suite in different environments - test, staging and possibly production and did not know what would be the best way to do it?
You came to the right place.
Typically, you record your tests on the development/test environment and then you want to run your tests on other environments as well.
We provide a base URL parameter that can be used in all remote runs methods.
Here's a list of components you can use to send a different base URL:
In every custom action/validation, you can access your base URL using the "BASE_URL" parameter. e.g. console.log("Base URL:" + BASE_URL)
To add the Base URL parameter to a Navigation Step:
- Hover over the + or Arrow icon where you want to add a new Navigation Step and click the Testim predefined steps button.
- Search for Add navigation action and click it.
- Input the URL using the BASE_URL parameter, followed by remaining URL path.
Single quote marks will be added before and after the URL (e.g., 'BASE_URL + '/Extension''). Delete these single quote marks (e.g. BASE_URL + '/Extension')
Testim will save the Navigation Step with your dynamic URL.
When the step runs, Testim will navigate to the Base URL used during setup. In the example below, Testim will navigate to http://demo.testim.io/login when the step runs.
In setup step in a test, you sometimes pass the base URL with a path to a specific location in your application. In that case, when passing a different base URL to the test, navigation will be relative to the base URL sent.
Example: If base Url in setup is http://staging.com/login , when passing this base Url parameter in runtime: http://preprod.com , the actual navigation in run time will be to : http://preprod.com/login.
In navigation steps, you sometimes navigate to a URL with the same host as in your setup step. In that case, when passing a different base URL to the test, navigation will be relative to the base URL sent.
Example: If base Url in setup is http://staging.com/ and the URL in navigation step is http://staging.com/ca . When passing this base Url parameter in runtime: http://preprod.com/ , the actual navigation in run time will be to : http://preprod.com/ca.
This allows you to rerun locally, a test that was run remotely with different base URL. It will also use the same parameters as run by the remote run.
Read more here.
Updated 3 months ago