Working with Global Variable


Global variables are persistent data elements that maintain a consistent value across an entire project. They are particularly useful when sharing data among Test Cases, Reusable Components, Gherkin Scenarios, Sparkin elements, items in the Service Repository, or within a Suite


Global variables are of two types: user-defined, created by users based on their needs, and system-defined, generated by the system but assignable by users. 

To create a Global variable for a project, follow the steps mentioned below: 


Login to the Opkey portal and select the project to work on.


Navigate to the Tools Menu on the left panel of your Project Workspace. 

Select Global Variables from the options available under Management.




The Global Variable window opens. Click on the “+” icon to add parameters to be mapped with the test case.




Note: The 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). 


A new row gets added to the User-defined Global Variable list. The Name field marked with * is mandatory. 



String is the default Data type for a Global variable, but you can choose a suitable datatype 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, select 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 additional feature of Global Variable which allows you to generate global variables with encrypted values utilizing the Secured String data type. 


When these Global Variables are created in their encrypted form, their actual values remain hidden from users. The values can be decrypted by giving a decryption password set in Opkey 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. However, 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).  



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 Execution Wizard, and select dropdown. Select any global variable whose value has to be changed. 



Change the values accordingly and proceed.


You now know how to work with Global Variable. 


Simplify your testing journey with Opkey. Read related articles Here.












Was this article helpful?

That’s Great!

Thank you for your feedback

Sorry! We couldn't be helpful

Thank you for your feedback

Let us know how can we improve this article!

Select atleast one of the reasons
CAPTCHA verification is required.

Feedback sent

We appreciate your effort and will try to fix the article