What are Global Variables?
Global variable are the variables possessing constant value throughout the project. These variables are beneficial when they are to be shared among various Business Component(s)/Business Process(es)/Test Case(s)/Job(s).
Modifications (if any) in the value of Global variable are done only at a single place; instead of modifying it at every place where this variable has been used in the project.
Types of Global Variables
Global variables can be either of the two types –
- User-defined -. the users can make their own variables as per the requirements and use them throughout the project.
- System defined – the Global Variables are created by the System but the user can provide its value.
How to create Global Variables in Accelerator?
To create a Global variable for the project, follow the steps mentioned below:
- Go to Tools in the menu bar. Select Global Variables.
A Global Variable pop up window will get open as
Getting familiar with the Icons of the Global variable:
- Default Browser & Default Mobile Device are the two system defined Global variables which will exist in each & every project (even in a new project.)
- Click Add.
- A new row will get added to the User defined Global Variable list.
- Name field marked with * is mandatory.
- String is the default Data type for a Global variable, but user can choose suitable data type for it by clicking on Data Type cell.
- Externally Updatable checkbox is marked checked, by default. It means that the user is allowed to change the value of Global variable at run time. If user uncheck this checkbox, then this Global Variable will not be shown under the Execute Now Global variable’s screen.
- You can view Used By record of any selected Global Variable as shown below:
Global Variable Encryption
OpKey has come up with an advanced feature of Global Variable Encryption which allows the users to create global variables with encrypted values of Secured String Data Type that can be used within the OpKey projects.
Once the Global variables are created in the encrypted format, their original value is never been displayed to the users [unless the user clicks on the Decrypt value icon] .
To do so, Select Secured String from Data Type Dropdown and enter the value. The value will be entered in encrypted format.
This Encrypted value cannot be edited. Although if you wish to edit or view value in decrypted format then, Click the Decrypt value icon. It will decrypt the value [provided there is no Decryption password set at the project level].
If there is any Decryption password set at the project level, then a pop up window will open up as follows. You need to enter the Decryption Password and click OK.
When these global variables are used in our Test scripts then their values are displayed in encrypted format throughout the project.
Once the Execution is completed, you have an option of decrypting the values by clicking on the Decrypt Result icon, where you need to enter the encryption password [if any].
You can also Export the result in Encrypted and decrypted format for the Detailed, Consolidated, failed and Integrated report.
The Global variable encryption feature can be used both for existing projects and newly created projects.
Multiple values for Global Variables
You can also assign multiple values to a Global Variable i.e a single global variable can have multiple values.
To do so, Select List from Data Type Dropdown.
Enter multiple values to the Global Variable and select the desired value as shown below.
Changing Values of Global Variables at Runtime:
- You can change the value of the Global variables at runtime.
- To do so, opt for the Advanced Settings in the Execution Wizard window.
- Click next till you reach the Global Variable settings window.
- Select any global variable whose value has to be changed.
- If the Global Variable is of List Type then, Select any default value from the list [for the runtime execution].
- If the Global Variable is of Secured String Type then, click Decrypt value icon
- A pop up window will get open. Enter the Decryption password set at the project level.
- Click Ok. Now, you will be allowed to edit the value at runtime.
- Click Finish to proceed with the Execution.