Shalini
Shalini

Reputation: 23

How to call a scenario from other scenario present in separate feature files? i.e. Feature1.feature Scenario1 Feature2>>scenario2

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

Upvotes: 0

Views: 1253

Answers (2)

Thomas Sundberg
Thomas Sundberg

Reputation: 4343

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.

Upvotes: 1

lumos42
lumos42

Reputation: 106

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.

Upvotes: 0

Related Questions