0

Reading one of the highly upvoted answer in this question: Reuse Cucumber steps there is a comment that says : "I recommend not using steps within steps at all"

Why is this the case? Please provide an example that shows the dangers involved. And please provide a work around the problem.

Community
  • 1
  • 1
johan.i.zahri
  • 316
  • 6
  • 18

1 Answers1

2

Because it becomes harder to maintain the cukes. The recommended solution is to write methods that cuke step definitions call. If you want one step to do several things, call several methods. The guy that wrote cucumber and the book on cucumber explains the thought process here.

Dave McNulla
  • 2,006
  • 16
  • 23
  • 1
    In the Cucumber book, there's a blurb--the Dangers of Nested Steps--about how nested steps increase complexity, obscurity, and dependency. Because cucumber's goal is to improve communication between product owners, testers, and developers, that's not ideal. But YMMV. It's an implementation choice. That being said, I never went down the nested steps road. – orde Jul 16 '15 at 00:37
  • 1
    @Dave McNulla Thanks for the answer though i would have hoped that rather than linking to the page, you'd share it here in the answer – johan.i.zahri Jul 16 '15 at 06:37