You can define variables and use them in multiple interfaces across Continuous Testing Platform. In this section:
General Variable Configuration
You can define variables in systems, environments, components, component instances, and variable sets that can be used in tests, jobs, and virtual assets. The process of defining variables in CTP is similar across all interface:
- Open the component and edit the variable table.
- Click the + icon at the bottom of the variables table.
- Specify the new variables, then save your changes.
The following image example shows variables being added to a variable set associated with a TST file.
Managing Global Variables in Environment Manager
You review, add, and modify all variables related to a specific environment from the Manage Instances page in Environment Manager. Refer to Managing Component Instances for details.
- Component instance variables can inherit values from component variables.
- Environment variables can inherit values from system variables.
- Environment and system variable values are not connected to component and component instance variable values.
- Variable sets used in tests jobs can inherit values from system variables.
All variable names are visible at the system level and shared between all environments on the same system. All variable names visible at the component level are shared between all instances of the same component.
The values defined in environment variables override the values inherited from system. Additionally, the values defined in component instance variables override the values inherited from component.
If the PATH variable is defined at the system level, for example, you can change its value–but not the variable name–when defining an environment in the system. You can also define new environment-level variables that are not present in the system. New variable names will be added to the system without values.
- variables defined in a variable set associated with a test in the job
- variables defined in the system, environment, or component.
See #Adding Variable Sets for additional information.
Overriding Values from the Environment Information Panel
Add the new value in the text field to override a value.
If you later want to remove return to the inherited variable (e.g., remove the override), click in that field, then click the Revert button in the right of that field.
From the Manage Instances Page
- Open the appropriate variable editor. (if it is not visible, click Show details or Expand all), then click the Edit button.
- Specify the desired values.
- If you want to see a modified value rendered as plain text before you save the changes, click the Apply icon.
From the Component Instance Wizard
When variable values are editable, you can mask or unmask them (if they were not yet saved).
In system/environment information panels, you can mask a value by clicking in that field, then clicking the Mask icon in the right of the field.
In other areas, you can mask a value by using the key icon to the right of the variable editor.
The exception is when editing variables that are inherited from SOAtest tests or within CTP (e.g., environment variables inherited from a system). These variables will inherit the parent’s masking setting. If the parent variable is masked, it cannot be unmasked at the inherited level. If you want to unmask it, you must do so at the parent level.
Adding Variable Sets
You can define a set of variables to be referenced within your test scenario or virtual asset. For example, you might want the WSDL, host, and port to point to different values for different test environments. When you specify these settings with variables (rather than hard-coding them in the tests), it is much easier to reuse the same test scenario across multiple environments.
Environment vs. Environment
One or more variables are referred to in SOAtest as an "environment" and are not to be confused with an environment as defined in Environment Manager.
If a .tst uses variable sets, you can specify how they are set within a specific Environment Manager component instance or test job. For example, you can run a test scenario with one set of variables against a performance testing environment, then run that exact same test scenario with another set of variables against a UAT environment.
Adding Variable Sets
To add a variable set to an existing .tst or .pva file:
- Choose a .tst or .pva and choose Add Variable Set from the action menu.
- (Optional) Modify the name of the newly-created variable set.
The variable sets are added to the test or virtual asset tree.
If multiple variables sets are added, a Variables folder will be automatically created to contain them.
Configuring Variable Values
To configure variable values, use the controls available in the Variable Set page.
If you want to mask a variable value, click the key icon to the right of the value field.
- Values that were entered and masked in this UI can be unmasked (if they were not yet saved) by clicking the key icon.
- Values that were entered and masked in SOAtest cannot be unmasked by clicking the key icon.
- Masking functionality requires SOAtest 9.9 or higher
Setting the Active Variable Set
The active variable set is the set that tests and virtual assets can currently draw values from. The active variable set is marked with the following icon:
Open the test scenario or virtual asset page and choose a variable set from the Active variables drop-down menu.
Click on a variable set and enable the Set as active option to mark the set as active.
Configuring the Variables for a Test Job
When you create a test job, you’ll have the option of using the variables from the active variable set or adjusting the values as needed.