Scenario Metadata - Ashthos/skutter GitHub Wiki
During a scenario execution, Skutter provides access to a set of metadata associated with the scenario. This can be useful when controlling the flow of a test from within code (step) or for outputting information about the test at runtime.
The step text, or command, is available in the this.step variable. It is the full text as specified in the .feature file.
Within a step, use the this.context.meta variable to access metadata about the step.
let meta = this.context.meta;
// meta.featureId = Unique identifier for the feature
// meta.featureTitle = The feature title, as defined in a .feature file using "Feature: <Title>"
// meta.scenarioId = Unique identifier for the scenario
// meta.scenarioTitle = The scenario title, as defined in a .feature file using "Scenario: <Title>"
// meta.stepId = Unique identifier for the executing step.
Additionally, you can access the list of feature, scenario and step annotations from within the step using the this.context.annotations variable. The annotations are flattened and presented as an array of strings, stripped of their @ sign.
For example:
@just
Feature: A test feature
@smoke-test
Scenario: A test scenario
this.context.annotations // ['just', 'smoke-test']
this.context.meta.featureTitle // 'A test feature'
this.context.meta.scenarioTitle // 'A test scenario'