Parameterize URLs
How do you run the same test in the same environment against different URLs? Put a variable in the URL.
This works well for URLs shaped like basepath.com/{extension}, where the base path is constant and the extension changes often or must be tested with different data sets.
Choose the variable type that matches what you want:
| Variable type | Result |
|---|---|
| Data-driven variable | The test runs against a different URL for each row of your data file. |
| Random application variable | The test runs against random URLs from your data sets. |
| Application variable | The test runs against a single URL. |
1. Declare the variables
Section titled “1. Declare the variables”- Application variables: declare them on the Variables tab in Settings. See Application variables.
- Random application variables: declare them on the Variables tab in Settings. See Random application variables.
- Data-driven file: follow Data-driven testing with a CSV file.
2. Use the variable in a test case URL
Section titled “2. Use the variable in a test case URL”- Open Edit Steps for any test case.
- Select the override URL checkbox. This makes the URL editable.
- In the path part of the URL, type the variable name wrapped in double underscores:
__variablename__.
