- 04 Feb 2024
- 2 Minutes to read
- Print
- DarkLight
Working with Global Variables
- Updated on 04 Feb 2024
- 2 Minutes to read
- Print
- DarkLight
Global variables are the stored data that retain a consistent value throughout the project. These variables prove beneficial when there is a need for them to be shared among different Test Case(s), Reusable Components, Gherkin scenarios, Sparkin elements, items in the Service Repository, or within a Suite.
Changes if any, are made to the value of the Global Variable at one single spot. This approach eliminates the need to modify it in every instance where the variable is utilized across the project.
These variables fall into two categories: user-defined, where users create their own variables based on their needs and use them across the project, and system-defined, where the system generates Global Variables but users can assign values to them.
To create a Global variable for the project, follow the steps mentioned below:
Login to the pCloudy platform.
Navigate to the 'Tools Menu icon' on the right panel and select Global Variable.
Click on the icon. A new page opens up.
Add the parameters, by clicking on ‘+’ button.
Default Browser and Default Mobile Device are the two system-defined Global variables that will exist in each & every project (even in a new project.) Click Add.
A new row gets added to the User-defined Global Variable list. Name field marked with * is mandatory.
- The string is the default Data type for a Global variable, but the user can choose a suitable data type for it by clicking on the Data Type cell.
You have the option to see where a specific Global Variable has been linked to. To do this, pick the Global Variable and press the "UsedBy" button. The "Used By" panel will display the name, complete path, description, and type of component of the artifact that uses the chosen Global Variable.
Global Variable Encryption
This is an advanced feature of Global Variable which allows the users to generate global variables with encrypted values utilizing the Secured String Data Type.
When these Global Variables are established in their encrypted form, their actual values remain concealed from users. The values can be decrypted by giving a decryption password set in pCloudy Admin at the project level.
To create Global variables with encrypted values, Select the Secured String from the Data Type Dropdown and enter the value as shown below:
This Encrypted value cannot be edited. Although if you wish to edit or view value in the decrypted format then, click the Decrypt value icon. It will decrypt the value [provided there is no encryption password set at the project level.
If an encryption password is configured at the project level, a pop-up window appears. You are required to input the encryption password and then click the OK button.
After the Execution is finished, you can choose to decrypt the values. To do this, click on the Decrypt Result icon. If there's an encryption password in place, you'll be prompted to enter it.
You can also Export the result in Encrypted or decrypted format for the Detailed report.
Changing Values of Global Variables at Runtime:
You can change the value of the Global variables at runtime. To do so, opt for the Global Variable tab on the Run Wizard, and select dropdown. Select any global variable whose value has to be changed.
It will update and proceed accordingly.