URL Replacements
  • 26 Feb 2024
  • 2 Minutes to read
  • Contributors
  • Dark
    Light

URL Replacements

  • Dark
    Light

Article summary

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].

URL_replacement_2_en.png

Specify [URL to be replaced] and [URL after replacement], and click [Create].
URL_replacement_3_en.png

You can also replace multiple URLs:

URL_replacement_1_en.png

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:

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 replacedURL after replacement
Replacement 1https://dev.example.comhttps://prd.example.com
Replacement 2https://dev.example.com/project1https://prd.example.com/projectA
URL in the scenarioURL after replacementReplacement
Case 1https://dev.example.comhttps://prd.example.comReplacement 1
Case 2https://dev.example.com/project1https://prd.example.com/projectAReplacement 2
Case 3https://dev.example.com/homehttps://prd.example.com/homeReplacement 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.


Was this article helpful?

Changing your password will log you out immediately. Use the new password to log back in.
First name must have atleast 2 characters. Numbers and special characters are not allowed.
Last name must have atleast 1 characters. Numbers and special characters are not allowed.
Enter a valid email
Enter a valid password
Your profile has been successfully updated.