I'm running my python tests with Behave
What i want to do is implement the same step, e.g "UserA calls UserB" in diffrent step files and to point the test to the correct step teach time.
For example:
The .feature file content:
Scenario: User A calls User B
Given UserA calls UserB
then, in the step folder, i'll have a .py file that will contain:
@given('UserA calls UserB')
def step_impl(context):
print('A call is being made')
And another step .py file that will contain:
@given('UserA calls UserB')
def step_impl(context):
print('A call is being made in another method')
I want to have control over which one of these steps will be executed. Is there a clean way to do that?
Found the answer after asking in the behave Github repository:
The best way to differentiate steps is to use test stages.
Example:
If i want to write the same steps with different implementation using the same .feature file i can open two directories:
dev_steps/
integration_steps/
and point to each of them in the behave command using stage:
behave --stage=dev
or
behave --stage=integration
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With