Search code examples
pythonbddscenariospython-behave

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


Solution

  • 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.