Global Variable
A global variable is declared and defined at the beginning of a program and can be accessed from any part of the code within its scope. It provides a consistent way to share data across functions or modules but requires careful management to avoid conflicts or unintended side effects.
Note:
Global Variable will already be available in a project.
If it is not available on the screen, you can do the below steps:
- Add key-value pairs under the Default category.
- Create sub-categories and add key-value pairs to it. To add a sub-category, click the "+icon" , type the name of the category in the text box and then press Enter.
Mention here a statement for the below steps:
Step 1: Choose a project, then access the "Variable" section from the side navigation panel.
Step 2: In the "Variables" section, select the radio button for the desired variable scope (global, environment, or test suite). An initial global variable will be created automatically.
Step 3: To create a new category, hover over the default category and click on the "+" icon. Enter the desired name for the category in the text box and press "Enter".
Step 4: Similarly, add keys and values by entering the relevant details in the respective text boxes.
Managing Global Variable
Select a project, access "Variable" from the side navigation panel, choose the "Global" radio button, select the category, and hover over the kebab menu to find options for Edit, Clone, and Delete Category.