3.3. Step - 03 : Run with defined steps¶
Let’s define some step mapping in features/steps/steps_addition.py
as shown below:
# features/steps/steps_addition.py
from behave import given, when, then
@given(u"I have '{num1:d}' and '{num2:d}'")
def given_i_have(context, num1, num2):
raise NotImplementedError("STEP: Geven I Have")
@when(u"I add them")
def when_i_add(context):
raise NotImplementedError(u"STEP: When I add them")
@then(u"The result must be '{value:d}'")
def then_the_result_must_be(context, value):
raise NotImplementedError(u"STEP: Then The result must be")
With above contents, if we run behave:
behave --no-timings --no-source
Although tests are failing, towards the end of the console log, you can see that behave
mentions that there are there are 0 undefined steps:
features/simple-addition.feature:7 Addition of single digit numbers
features/simple-addition.feature:12 Addition of double digit numbers
0 features passed, 1 failed, 0 skipped
0 scenarios passed, 2 failed, 0 skipped
0 steps passed, 2 failed, 4 skipped, 0 undefined
Took 0m0.003s