Execution Variables

There are multiple scenarios to use Execution Variables:

  • Variables in a Test Case which you want to be configurable and change between executions. For Example: run a Test Case with different login information or customer numbers

  • Variables that depend on a configuration or Test Environment. For example: the connection string to your database

  • Variables like passwords which you want to store encrypted and not write as plain text directly in a Test Case

Portal Execution Variables

Test Executions which you start in the Portal use the Execution Variables set on the Software Versions and on the Test Case.

If you start an Execution in Visual Studio directly the combination of Local and Portal are loaded (assuming a connection to the Portal exists).

Set Variables which are used by multiple Test Cases, for example Login Information. Variables which are only used by one Test Case can be set directly on them. For example which customer number to use.

Variables on a Software Version

In the Software and Environments Tab click the Edit Button to Edit your Software Version

Variables on a Test Case

Execution Variables can be set and edited on a Test Case with the following Button:

More information about about all the options of Portal Execution Variables can be found here.

Local Execution Variables

Local Execution Variables are mainly used to set Variables which are secured/encrypted on the Portal and you do not have access to it. Or if you want to try other values than the ones set on Portal in a local execution.

  • If you start an Execution in Visual Studio directly the combination of Local and Portal are loaded (assuming a connection to the Portal exists).

  • Secured (and therefore encrypted) variables from the Portal can not be loaded. So you need to set for example password variables again locally.

  • Local Variables have the higher priority, so you can overwrite values from the Portal by using the same Key in your Local Variables.

  • Local Variables are set on Solution Level, so they apply to all Test Cases.

  • Local Execution Variables are stored in the .trio.user.json file in your solution folder, which is ignored by git. Therefore each user needs to set them separately.

Set Local Variables

Navigate to the Solution Explorer and use the Context Menu on the Solution as shown below to open "Manage Execution Variables"

Use the upper table to add, edit and remove Local Execution Variables.

Below you can select a Test Case and check which variables are set on the Portal.

If you want to overwrite a Variable for your local execution click the Copy button and the entry will be added to the Table above, allowing you to edit the value.

Using Variables in a Test Cases

To access a Variable in a Test Case use t.GetVariable

For Example to get the Value of the Variable with the Key "isManaged":

string isManagedVariable = t.GetVariable("isManaged");

Optionally add a second string as parameter to have a fallback value if the Variable could not be found:

string isManagedVariable = t.GetVariable("isManaged", "False");

Inspect Variables used in a Test Execution

Which variables where loaded during a Test Execution can be seen at the beginning in the Debug Log:

Last updated