0

As there is no restriction on number of lines(Steps/Gherkin) that a scenario should have , but still did anybody face issues in having more number of steps in a scenario (may be 15 or 20 steps) . Is anywhere it mentioned that using particular number of lines is a good practice? (Some reference would be helpful for me to show as a proof)

Thanks Sudhir

2 Answers2

1

There is up to tester to choose whether to use imperative or declarative style of Gherkin scenarios. The main difference between them - the level of abstractions. Generally it is recommended to use declarative style and keep scenarios small and undestandable by product owner or business analytics (non-technical people).

More information can be found in the following blogs:

1

There is no restriction regarding the number of lines in a Gherkin scenario. At least no technical limitations.

The limitation is rather understandability. Is it easy or is it hard to understand and maintain? This is a very subjective measurement. This is the very same limitation as with code. Is a method easy or hard to understand and maintain? Some people, including me, feel uncomfortable when a method does many things and is longer than a handful lines of code. Some people happily deliver methods that are many hundreds of lines of code.

I did a write up from a podcast where some of the maintainers of Cucumber discuss BDD anti-patterns. It may serve you as a source to refer to. http://www.thinkcode.se/blog/2016/06/22/cucumber-antipatterns

The original podcast can be found here: https://cucumber.io/blog/2016/05/09/cucumber-antipatterns

Unfortunately, your question is about opinions and we know that opinions vary a lot.

Thomas Sundberg
  • 4,098
  • 3
  • 18
  • 25