0

This seems like an obvious question to me but I cant seem to find an answer on it anywhere which is making me think its a practice that I shouldn't be doing.

I have a feature file step which is there purely for business context on the scenario so no action is required against the system. The problem being that cucumber tries to find a step def method that matches the feature file Gherkin text and therefore the feature fails.

Is there a way to tell cucumber not to expect a step def for a certain line from a feature file?

0

3 Answers 3

1

You can simply add a commented line if it's better for understanding the scenario.

Otherwise you can alway add an empty step, even a generic one like "Business Context:...." to reuse that empty step for multiple purposes.

0

I'd just leave the definition for that step empty, although I would wonder why a step that doesn't affect the scenario should be included in the scenario itself. Maybe it could be moved in the description of the scenario.

0

Technical explanation:

There is no way of skipping a step - you would need to create an empty step definition.

Processual explanation:

Features files aim to describe how a feature will work, creating a unambiguous vocabulary. Having a step (description of something) that is not checked or acted upon (even if it is done manually with the ask function) would add unnecessary words on your description.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.