Creating Variables in Offline Mode using Override

Updated by Aishwarya Rai

On many occasions, you may want to use multiple versions of the same test case or template with only subtle variations among all of them. These variations may be related to certain data which is unique to that test case/template and which may be dynamically generated, such as dynamically generated usernames or passwords.

To save you the hassle of creating and re-creating repetitive steps across test cases, Sofy allows you to declare local variables in offline mode by "temporarily" overriding global variables. This makes it easy for you to simply store temporary values for a variable which are accessible across the entire test case as well as any templates contained inside it. This allows you to leverage unique values of variables inside test cases and override variable values at runtime to give you different results.

As an example, let's consider you have a template where you are searching for hotels in a city such as "Milan" and are re-using this template across many test cases. Now considering another similar test case which uses this same template, and you want to search for hotels in "Barcelona" (instead of "Milan"), here's how you you can do it without re-recording your steps :

  1. Open up a test case to which you want to add a variable in Offline mode from the Automation section:
  2. Click on the 3 dots you see next to any test case step and click on Add Variable option from the menu:
  3. A new modal appears from which you can select the Test Data variable (in our case, this variable is called "City" and holds the city name). This Test Data variable ("City") would be the one you want to temporarily override and you might also be using it inside any Template in the subsequent steps. Once you select this Test Data variable, you can provide it's temporary value (in our case, "Barcelona"). This temporary, override value will be applicable to only the current test case and any associate templates inside it:

  1. This override step will now show up within your test case like this:
  2. The test case and the template inside it will now execute with the overridden value. As an example, suppose you originally were using a Test Data variable with value "Milan" (in Step 5) but now you provided an override value "Barcelona" (in Step 4), the test case as well as the template will now acquire value "Barcelona" and use the same wherever applicable:
  3. Once you finish providing a new local value, you can save the test and execute it. You will see that it now runs with the new value of the variable:

Viewing Results of a Test with an overridden variable

  1. Navigate to the Runs & Results tab in the Automation section and select your run depending on Schedule vs Lab Run:
  2. Now if you click on the step where you may have overridden a variable, you will see which value it acquired in the Details section:
  3. Additionally, if you open up a step where you may have used this overridden variable, you can find its original vs new value as well:

How did we do?