- Print
- DarkLight
What are URL replacements?
Do you use several environments when making changes to your corporate website? These environments can go by many names: staging, dev, production, etc. Typically, each environment has a different URL, but the websites tested are the same.
With Autify's URL replacement feature, you won't have to create a new scenario for each URL. Simply replace the relevant URLs in the scenario and start running tests.
How to set up URL replacements
Open the Test Plan Details Page. Under [URL Replacements], click [Add].
Specify [URL to be replaced] and [URL after replacement], and click [Create].
You can also replace multiple URLs:
All URLs within the scenario that exactly match [URL to be replaced] will be replaced with [URL after replacement].
URL to be replaced
When you execute a test plan, the following URLs will be replaced from [URL to be replaced] with the URL you specified in the [URL after replacement].
- The start URL in the first step.
- The URL of Go-To Steps.
- URLs contained in the input values of input steps, etc.
- The URL of "URL Should Be/Contain" assertion steps.
- The URL in page element assertions.
- The URL in JS Steps.
- If the URL is dynamically created within the JS step, it will not be replaced.
// subject to replacement return "https://autify.com"
// not subject to replacement return "https://" + "autify.com"
- The URL in steps within Step Groups. (If the URL within a Step Group is overwritten with [URL to be replaced], it will be replaced with the URL specified in [URL after replacement] before execution.)
- The URL in JavaScript snippets.
URL not to be replaced
The following URLs will not to be replaced:
- URLs set in Variables
Examples
Here are three examples of how URLs in scenarios are replaced.
In this example, we assume that there are two URLs we want to replace. We will call them Replacement 1 and Replacement 2.
In Case 1, the URL in the scenario is an exact match with [URL to be replaced], so it's replaced with the URL specified in [URL after replacement].
URLs are replaced starting from the longest [URL to be replaced].
Therefore, in Case 2, Replacement 2 is applied instead of Replacement 1.
In Case 3, Replacement 1 is applied - the front part of the URL is replaced.
URL to be replaced | URL after replacement | |
---|---|---|
Replacement 1 | https://dev .example.com | https://prd .example.com |
Replacement 2 | https://dev .example.com/project1 | https://prd .example.com/projectA |
URL in the scenario | URL after replacement | Replacement | |
---|---|---|---|
Case 1 | https://dev .example.com | https://prd .example.com | Replacement 1 |
Case 2 | https://dev .example.com/project1 | https://prd .example.com/projectA | Replacement 2 |
Case 3 | https://dev .example.com/home | https://prd .example.com/home | Replacement 1 |
Note:
If you plan to use the URL replacement feature to create test plans for different execution environments, we recommend that you name your scenario with URL replacement in mind.