Variables can act as constants, much like Identity Manager Global Constant Values (GCV) and they can also be assigned with new values during test execution. In order to enforce the disciplined use of Variables and eliminate the side-effects of mistyping variable names and accidentally overwriting values, Identity Validator 2.0 requires that all variables be declared before using them.
By using Variables in your tests, you can make your tests more flexible and easy to maintain. For example, instead of hard-coding an object name in a test, set a variable at the top of the test that contains the test object cn or dn, then reference that variable throughout your test. You can use this technique for attribute names and values as well, thus allowing you to create templates that use your customized set of variables to accomplish repetitive tasks such as deleting and creating test objects. See Using Templates.
Converting connection information to variables can be done on the Connection Editor page by clicking the Covert Values to Variables. This allows you to utilize the Variable Environments feature so you can easily change the test to access servers in different environments, such as Dev, QA, and Prod.
Declaring variables can be done in two places, one is at the Test Suite tab > Variables menu, and in the second is at Variable Browser. Variables do not need an initial value if you are simply declaring them so they can be assigned values within a test.
Variable values can contain references to other variables.
Example 1: var1=$(var2}{$var3}
Example 2: idx=2, var1=${var${idx}}
IMPORTANT:Variables that contain other variables as in example 2, must be assigned its value in the Variables panel. If you assign a complex value using the Set Variables action, it will store a partially resolved value in the variable (for example, ${idx} which is resolved to “2” as in var1=${var2}).
Referencing variables can be done in any text field in Identity Validator 2.0. If you want to declare a variable in the browser, click the
icon. When you select a variable to use, it will insert a variable reference in the following format: ${variable name} in the last text field you were editing. If you want to insert a variable reference, you can do it manually by typing in the same variable reference that the variable browser inserts. If you reference a variable that has not been declared or has been deleted, Identity Validator 2.0 will treat the reference as literal text. If you attempt to assign a value to an undeclared variable (because the variable was deleted at one point), a pop-up will appear during test execution indicating that the variable does not exist. To fix this, simply declare the variable.
Dynamically assigning values to variables is done in connectors that support such actions. Actions typically have a description of “and set variable” in their names. For example, the LDAP connector has an action “Get Object FDN and Set Variable” to place the located object’s DN into a variable.
Variable Environments (also known as Variable Groups) are used to switch between different testing environments. You can have a set of variables for each environment, such as Dev, QA, and so on. As long as you use variables in your connection definitions and in your tests, you can easily switch environments.
To change the active variable environment, go to the Variables management page and select a different environment. The active environment is displayed in the Identity Validator 2.0 header.