0

In Behave, for python How to call a scenario from other scenarios present in separate feature files? i.e. In Feature1.feature file Scenario1 Feature2.scenario2 Feature3.scenario3

Shalini
  • 23
  • 3

2 Answers2

1

Calling scenarios from scenarios is not supported by Gherkin and thus not possible.

What you can do is call a strep implementation from another step. Calling steps from another step is, however, an anti-pattern and not a good idea. It will lead you down a bad path.

What you want to do is to call a helper method from both step implementations. I.e. move the desired functionality from a step to a common helper method and use that functionality from both steps.

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

Probably you want to call steps, not scenarios(which is a collection of steps). Use execute_steps to call steps directly from other behave steps.

lumos42
  • 106
  • 8