Varg
3.2.19 Varg
DESCRIPTION
Varg - Define ("Varg set") or delete ("Varg delete") a variable with the specified visibility scope. Supported since v6.3.
The command is an extension of the Var command:
- Var can only create/set variables with the local (inside a code block) or script visibility. Varg adds support of session (global) variables which allow scripts or workitems to share data.
- Var determines the visibility scope from the context. A variable defined in the main script body will have the script visibility while a variable defined inside a structured code block (if/else, for, procedure) will be a local one. On contrary Varg works with an explicit scope. This approach is more flexible because you may for example create script variables inside structured blocks.
- Varg introduces the ability to delete variables. This is useful where the script needs to branch on a variable existence (the 'exists' boolean operator). As the script XML report stores variables it can be also used to remove sensitive data.
There's a CLI option called --variable-session to create a session variable on the automation start.
SYNOPSIS
Varg set name=<variableName> [value=<variableValue>] [scope=<visibilityScope>]
* Red colour indicates obligatory parameters
OPTIONS
name=<variableName>
- The variable name. It is case sensitive and it may not contain spaces or the equals character ('=').
value=<variableValue>
- The variable value.
scope=<variableScope>
- The visibility scope, one of:
- local - The variable will be visible only within the code block it is declared in, for example inside a for, if/else or procedure.
- script - Visible within a single script and all scripts called from it.
- session - Available to all scripts within the same session. The variable will exist until the application gets terminated.
Lower scopes have higher priority. For example, a local variable will override a session one of the same name. If the scope is omitted it defaults to the 'script' one.
Varg delete name=<variableName> [scope=<visibilityScope>]
* Red colour indicates obligatory parameters
OPTIONS
name=<variableName>
- Name of the variable to delete. It is case sensitive and it may not contain spaces or the equals character ('=').
scope=<variableScope>
- The visibility scope, one of 'local', 'script' or 'session'. If the scope is omitted the command will delete all variables of the specified name across all scopes.
RETURNS
The Varg command always returns 0 (zero).
EXAMPLES
Varg set name="S"
value="Hello"
scope=
"session"
- Create or set a session variable called 'S'.
Varg delete name="S"
scope=
"session"
- Delete the session variable created in the previous example. Leave all other variables of the same name that exists at the local or script scopes.