Back to Index.
Using variables

Using variables

This feature provides an example on how to use variables in GingerSpec. The default definition of a variable is ${variableName}. GingerSpec will try to get the value of 'variableName' before executing the step. if GingerSpec is unable to find the value, the test will fail. You can use variables at any point in your feature file: feature title, description, scenario description steps, datatables, docstrings and even comments. There are many ways of creating new variables: you can pass variables via the CLI using -DvariableName=variableValue, or they can be defined in a previous step. You can also use variables to automatically generate fake data. Please, read the full documentation here: https://github.com/josefd8/gingerspec/wiki/Gherkin-variables


  1. Using variables in Scenario names, titles, log messages, datatables, docStrings


  2. Creating local variables


  3. Injecting system variables via CLI


  4. Using default values


  5. Using interpolation (StringSubstitutor library)


  6. Recursive variable replacements


  7. Using environment-dependent variables


  8. Generating fake data


  9. Resolving mathematical expressions


  10. Miscellaneous and examples