For example i have following scenario in a feature file
Scenario: A Scenario
Given a precondition
When step 1
And step 2
Then step 3
In Ruby i can write stepdefinition for above scenario as following:
Given("a precondition") do
end
When("step 1") do
end
And("step 2") do
end
Then("step 3") do
end
I have to implement this using Python Behave and i am confused about And implementation annotation in stepdefinition for this, i did not find @and in the examples i referred.
@given("a precondition")
def given_implementation(context)
pass
@when("step 1")
def when_implementation(context)
pass
#which annotation to use for and??
def and_implementation(context)
pass
@then("step 3")
def then_implementation(context):
pass
And
merely inherits from whatever the previous step was. From the docs,
So in your case, you'd want to change your step implementation to the following:
@given("a precondition")
def given_implementation(context)
pass
@when("step 1")
def when_implementation(context)
pass
@when("step 2") <--------------------- Changed to this!
def and_implementation(context)
pass
@then("step 3")
def then_implementation(context):
pass