String Interpolation
Since v1.0.0
It is often useful to reference settings, captured values and other text throughout your feature and meta files. To support this, Gwen provides a placholder substitution mechanism.
Placeholder Syntax
Placeholders are declared using the ${placholder}
syntax and can include:
- An environment variable name (since gwen-web 2.36.0)
- example:
${env.USER}
for theUSER
variable
- example:
- A system property name
- A Gwen setting name
- A named binding in the currently accessible scope
- JS arrow functions
Examples
Substitution involves replacing named placeholders with their values.
Feature: String Interpolation
Scenario: By Substitution
Given my mechanism is "substitution"
And my value is "${my.property}"
And my proposition is "By ${my mechanism}, my value will be ${my value}"
Then my proposition should be "By substitution, my value will be ${my.property}"