--- title: "Test Plan Variables | Autify Guide" slug: "test-plan-variables" updated: 2023-11-27T06:00:43Z published: 2023-11-27T06:00:43Z canonical: "help.autify.com/test-plan-variables" --- > ## Documentation Index > Fetch the complete documentation index at: https://help.autify.com/llms.txt > Use this file to discover all available pages before exploring further. # Test Plan Variables ## Overview Test Plan Variables are key-value pairs configured in a Test Plan that can be referred to by scenarios in the Test Plan. When you want to have shared variables across scenarios in a Test Plan, such as User IDs or some environmental settings, Test Plan Variables will be useful. ## Use Variables ### Priority of Variables As Autify has a mechanism of [Passing Variables Between Tests](https://help.autify.com/docs/en/passing-variables-between-tests), variables can be flexibly used at different levels. Before moving on to Test Plan Variables, let’s take a look at how these different kinds of variables work on Autify. Variables referenced by scenarios can be defined as key-value pairs called Import Variables. When a Scenario with Import Variables is run in a Test Plan, variables will be looked up in the following order: 1. Variables returned as **Export Variables** from the preceding scenario execution in the test plan 2. Variables defined in the Test Plan (**Test Plan Variables**) 3. **Default Values of the Import Variables** defined in the scenario ![Variables-en.png](https://cdn.document360.io/a099d8a2-cfd2-42ca-9906-68b4a337f4a5/Images/Documentation/Variables-en.png?sv=2026-02-06&spr=https&st=2026-11-08T19%3A54%3A05Z&se=2026-11-08T20%3A54%3A05Z&sr=c&sp=r&sig=GblvbTt3HfBuFK%2F6keuET1JTgwZf9UAMJ1brhQyTbYY%3D) See also [Passing Variables Between Tests](https://help.autify.com/docs/en/passing-variables-between-tests). ### Create a Scenario that refers to Test Plan Variables To make it possible for a Scenario to refer to Test Plan Variables, you need to create a Scenario with Import Variables. For more details, see [Set Import Variables](https://help.autify.com/docs/en/passing-variables-between-tests#set-import-variables). ![Screen Shot 2023-11-13 at 8.52.57.png](https://cdn.document360.io/a099d8a2-cfd2-42ca-9906-68b4a337f4a5/Images/Documentation/Screen%20Shot%202023-11-13%20at%208.52.57.png?sv=2026-02-06&spr=https&st=2026-11-08T19%3A54%3A05Z&se=2026-11-08T20%3A54%3A05Z&sr=c&sp=r&sig=GblvbTt3HfBuFK%2F6keuET1JTgwZf9UAMJ1brhQyTbYY%3D) ### Create variables in a Test Plan Next, let’s create a Test Plan with Test Plan Variables. Go to Test Plan Details page and find “Test plan variables” section. Click “Add” button to create a new variable. ![Screen Shot 2023-11-12 at 21.20.48.png](https://cdn.document360.io/a099d8a2-cfd2-42ca-9906-68b4a337f4a5/Images/Documentation/Screen%20Shot%202023-11-12%20at%2021.20.48.png?sv=2026-02-06&spr=https&st=2026-11-08T19%3A54%3A05Z&se=2026-11-08T20%3A54%3A05Z&sr=c&sp=r&sig=GblvbTt3HfBuFK%2F6keuET1JTgwZf9UAMJ1brhQyTbYY%3D) Input a key and a value for the variable, and click “Create” button. Make sure that the keys are the same as what you have as Import Variables in the Scenarios. ![Screen Shot 2023-11-12 at 21.21.27.png](https://cdn.document360.io/a099d8a2-cfd2-42ca-9906-68b4a337f4a5/Images/Documentation/Screen%20Shot%202023-11-12%20at%2021.21.27.png?sv=2026-02-06&spr=https&st=2026-11-08T19%3A54%3A05Z&se=2026-11-08T20%3A54%3A05Z&sr=c&sp=r&sig=GblvbTt3HfBuFK%2F6keuET1JTgwZf9UAMJ1brhQyTbYY%3D) By repeating this process, you can create up to 50 Test Plan Variables in a Test Plan. ![Screen Shot 2023-11-12 at 21.22.52.png](https://cdn.document360.io/a099d8a2-cfd2-42ca-9906-68b4a337f4a5/Images/Documentation/Screen%20Shot%202023-11-12%20at%2021.22.52.png?sv=2026-02-06&spr=https&st=2026-11-08T19%3A54%3A05Z&se=2026-11-08T20%3A54%3A05Z&sr=c&sp=r&sig=GblvbTt3HfBuFK%2F6keuET1JTgwZf9UAMJ1brhQyTbYY%3D) ### Run tests with variables Now, let's take a look at how tests run with Test Plan Variables using the following example. #### Scenario This Scenario imports `FIRST_NAME` and `LAST_NAME` as variables. The default value of `FIRST_NAME` is "Foo", and that of `LAST_NAME` is "Bar". ![Screen Shot 2023-11-21 at 1.16.57.png](https://cdn.document360.io/a099d8a2-cfd2-42ca-9906-68b4a337f4a5/Images/Documentation/Screen%20Shot%202023-11-21%20at%201.16.57.png?sv=2026-02-06&spr=https&st=2026-11-08T19%3A54%3A05Z&se=2026-11-08T20%3A54%3A05Z&sr=c&sp=r&sig=GblvbTt3HfBuFK%2F6keuET1JTgwZf9UAMJ1brhQyTbYY%3D) In the scenario, `FIRST_NAME` and `LAST_NAME` are used for Input steps. ![Screen Shot 2023-11-21 at 1.16.41.png](https://cdn.document360.io/a099d8a2-cfd2-42ca-9906-68b4a337f4a5/Images/Documentation/Screen%20Shot%202023-11-21%20at%201.16.41.png?sv=2026-02-06&spr=https&st=2026-11-08T19%3A54%3A05Z&se=2026-11-08T20%3A54%3A05Z&sr=c&sp=r&sig=GblvbTt3HfBuFK%2F6keuET1JTgwZf9UAMJ1brhQyTbYY%3D) #### Test Plan This Test Plan has `FIRST_NAME` and `LAST_NAME` as Test Plan Variables. The default value of `FIRST_NAME` is "Hatty", and that of `LAST_NAME` is "Bee". ![Screen Shot 2023-11-22 at 17.47.46.png](https://cdn.document360.io/a099d8a2-cfd2-42ca-9906-68b4a337f4a5/Images/Documentation/Screen%20Shot%202023-11-22%20at%2017.47.46.png?sv=2026-02-06&spr=https&st=2026-11-08T19%3A54%3A05Z&se=2026-11-08T20%3A54%3A05Z&sr=c&sp=r&sig=GblvbTt3HfBuFK%2F6keuET1JTgwZf9UAMJ1brhQyTbYY%3D) #### Test results When the test is run individually by "Run Now", the Scenario will use the default values of Import Variables: - FIRST_NAME = `Foo` (default value) - LAST_NAME = `Bar` (default value) ![Screen Shot 2023-11-21 at 1.17.20.png](https://cdn.document360.io/a099d8a2-cfd2-42ca-9906-68b4a337f4a5/Images/Documentation/Screen%20Shot%202023-11-21%20at%201.17.20.png?sv=2026-02-06&spr=https&st=2026-11-08T19%3A54%3A05Z&se=2026-11-08T20%3A54%3A05Z&sr=c&sp=r&sig=GblvbTt3HfBuFK%2F6keuET1JTgwZf9UAMJ1brhQyTbYY%3D) On the other hand, when this Scenario is run in the Test Plan, the Test Plan Variables will be referred to. - FIRST_NAME = `Hatty` (test plan default value) - LAST_NAME = `Bee` (test plan default value) ![Screen Shot 2023-11-21 at 1.17.50.png](https://cdn.document360.io/a099d8a2-cfd2-42ca-9906-68b4a337f4a5/Images/Documentation/Screen%20Shot%202023-11-21%20at%201.17.50.png?sv=2026-02-06&spr=https&st=2026-11-08T19%3A54%3A05Z&se=2026-11-08T20%3A54%3A05Z&sr=c&sp=r&sig=GblvbTt3HfBuFK%2F6keuET1JTgwZf9UAMJ1brhQyTbYY%3D) ## Use Cases ### Testing against different multiple environments One of the common use cases of Test Plan Variables is to use different values against different test environments. This is very powerful when used with URL replacement feature. Let’s assume that we want to run the same test plans for a Production environment and Staging environment with different User IDs: | | URL prefix | User ID | | --- | --- | --- | | Production | https://prd.example.com | prd@example.com | | Staging | https://stg.example.com | stg@example.com | In this case, your goal can be achieved by the following: - Create Scenarios that import the User ID as Import Variables - Create a Test Plan for each environment, Production and Staging with - URL replacement for the environment (Production/Staging) - Test Plan Variable for User ID This way, you can easily leverage your Test Plan to cover multiple environments with variables. #### Test Plan for Staging environment ![Screen Shot 2023-11-21 at 0.53.36.png](https://cdn.document360.io/a099d8a2-cfd2-42ca-9906-68b4a337f4a5/Images/Documentation/Screen%20Shot%202023-11-21%20at%200.53.36.png?sv=2026-02-06&spr=https&st=2026-11-08T19%3A54%3A05Z&se=2026-11-08T20%3A54%3A05Z&sr=c&sp=r&sig=GblvbTt3HfBuFK%2F6keuET1JTgwZf9UAMJ1brhQyTbYY%3D) #### Test Plan for Production environment ![Screen Shot 2023-11-21 at 0.55.39.png](https://cdn.document360.io/a099d8a2-cfd2-42ca-9906-68b4a337f4a5/Images/Documentation/Screen%20Shot%202023-11-21%20at%200.55.39.png?sv=2026-02-06&spr=https&st=2026-11-08T19%3A54%3A05Z&se=2026-11-08T20%3A54%3A05Z&sr=c&sp=r&sig=GblvbTt3HfBuFK%2F6keuET1JTgwZf9UAMJ1brhQyTbYY%3D) We are looking forward to seeing what you will build with Test Plan Variables!