Assigning and Accessing Variables
Assigning Variables
Variables can also be directly created and assigned for use within a Feature File. A new variable can be created and assigned a value using the following Step:
I assign "ABC" to variable "my_stoloc"
Accessing Variables
Once a value is stored in a variable, the variable can be used in any subsequent Step within a given Scenario in place of a Step argument by referencing the variable with the $ qualifier.
I enter $my_stoloc
Note: Cycle treats any text between quotes as a literal string. This means that a $VAR inside of quotes is not treated as a variable. For example, the Step:
I enter "$lodnum"
would result in $lodnum being typed on the screen.
Echoing variable values
An easy way to see the value of a variable is using:
I echo $my_stoloc