python - Behave / python3: Test undefined even if the step function is present -
i have started using behave define behaviour-driven tests on python3. first tests went fine, incurring in puzzling error.
i have define gherkin file sra-to-isatab-batch-conversion.feature
:
feature: sra isa-tab batch conversion # perform batch conversion of set of sra datasets, retrieved european nucleotide archive # isa-tab scenario: batch conversion form list of sra accession numbers given access number "era000084" , nothing else when sra isa tab conversion invoked should return zip file object , zip file should contain many directories element in list
then define following step methods in file steps/sra-to-isatab-batch-conversion.py
from behave import * use_step_matcher("parse") @given('an access number "{access_number}"') def step_impl(context, access_number): context.access_number = access_number print(context.access_number) @step("nothing else") def step_impl(context): print("nothing else") @when("the sra isa tab conversion invoked") def step_impl(context): pass @then("it should return zip file object") def step_impl(context): pass @step("the zip file should contain many directories element in list") def step_impl(context): pass
if run behave sra-to-isatab-conversion.feature
step function related when
step appears missing:
feature: sra isa-tab batch conversion # sra-to-isatab-batch-conversion.feature:2 scenario: batch conversion form list of sra accession numbers # sra-to-isatab-batch-conversion.feature:6 given access number "era000084" # steps/sra-to-isatab-batch-conversion.py:6 0.000s , nothing else # steps/sra-to-isatab-batch-conversion.py:40 0.000s when sra isa tab conversion invoked # none should return zip file object # none , zip file should contain many directories element in list # none /users/massi/projects/oerc/isa-api/features/test_outputs failing scenarios: sra-to-isatab-batch-conversion.feature:6 batch conversion form list of sra accession numbers 0 features passed, 1 failed, 0 skipped 0 scenarios passed, 1 failed, 0 skipped 2 steps passed, 0 failed, 2 skipped, 1 undefined took 0m0.001s can implement step definitions undefined steps these snippets: @when(u'the sra isa tab conversion invoked') def step_impl(context): raise notimplementederror(u'step: when sra isa tab conversion invoked')`
i have tried redefine step description change number of given statements,i have rewritten files, same errors. if copy statement suggested in error message still same error.
can explain me doing wrong? using python 3.4 behave 1.2.5 pycharm 5.0.4 (notice pycharm bdd tools recognise matching between statements in gherkin file , step functions)
hmmm, working fine me exact implementation pasted above. environment issue or , installation problem. can try reinstalling behave? running terminal or pycharm?
ps: not issue, don't need specify use_step_matcher() method if using parse; since default step_matcher
also (making sure not pasting human error you): @when step method has indentation issue on "pass" statement. in code or format issue here in forum?
Comments
Post a Comment