Variable scope

Description

Defines scope of a variable

Possible scopes

Name Description

step

The scope is used within nested steps and the variables are invalidated after the nested steps are executed.

scenario

Variable declared with the scenario scope is available in the rest of the scenario after it’s declared. The scenario scoped variables are invalidated once the scenario is completed.

story

Variable declared with the story scope is available in the rest of the story after it’s declared. The story scoped variables are invalidated once the story is completed.

next_batches

Variable declared with the next_batches scope is available in the next batches. The next_batches scoped variable is not available in batch it’s declared within.

global

Such variables are declared only in *.properties files with bdd.variables.global. prefix and available in all stories. Attempt to save the globally scoped variables in stories leads to an exception.

Notes

  • Scope names are case insensitive

  • The story scoped variables declared inside given stories are available in the parent story