8000 test_bdd failures when behave is bumped to 1.2.7.dev6 · Issue #128 · AlexandreDecan/sismic · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content
test_bdd failures when behave is bumped to 1.2.7.dev6 #128
Open
@booxter

Description

@booxter
============================= test session starts ==============================
platform darwin -- Python 3.12.8, pytest-8.3.3, pluggy-1.5.0
rootdir: /private/tmp/nix-build-python3.12-sismic-1.6.8.drv-0/source
plugins: mock-3.14.0
collected 345 items / 12 deselected / 333 selected                             

tests/test_bdd.py ......FFFFF...................                         [  9%]
tests/test_code.py .............X                                        [ 13%]
tests/test_contract.py ..............                                    [ 17%]
tests/test_examples.py ...............                                   [ 21%]
tests/test_interpreter.py .............................................. [ 35%]
...............                                                          [ 40%]
tests/test_io.py ....................................................... [ 56%]
..........................................................               [ 74%]
tests/test_model.py .................................................... [ 89%]
...........                                                              [ 93%]
tests/test_property.py ..............                                    [ 97%]
tests/test_runner.py .........                                           [100%]

=================================== FAILURES ===================================
_____________ TestMicrowave.test_microwave_with_steps[no contract] _____________

self = <tests.test_bdd.TestMicrowave object at 0x104d61070>
microwave = Interpreter(Statechart('Microwave controller'))

    def test_microwave_with_steps(self, microwave):
        features = ['cooking_human', 'lighting_human', 'safety_human']
    
>       assert 0 == execute_bdd(
            microwave.statechart,
            [os.path.join('docs', 'examples', 'microwave', f+'.feature') for f in features],
            step_filepaths=[os.path.join('docs', 'examples', 'microwave', 'steps.py')],
        )
E       AssertionError: assert 0 == 1
E        +  where 1 = execute_bdd(Statechart('Microwave controller'), ['docs/examples/microwave/cooking_human.feature', 'docs/examples/microwave/lighting_human.feature', 'docs/exam
ples/microwave/safety_human.feature'], step_filepaths=['docs/examples/microwave/steps.py'])
E        +    where Statechart('Microwave controller') = Interpreter(Statechart('Microwave controller')).statechart

tests/test_bdd.py:44: AssertionError
----------------------------- Captured stdout call -----------------------------
USING RUNNER: behave.runner:Runner
Feature: Cooking # docs/examples/microwave/cooking_human.feature:1

  Scenario: Start cooking food                # docs/examples/microwave/cooking_human.feature:3
    Given I open the door                     # sismic/bdd/wrappers.py:35
    And I place an item in the oven           # sismic/bdd/wrappers.py:35
    And I close the door                      # sismic/bdd/wrappers.py:35
    And I press increase timer button 5 times # sismic/bdd/wrappers.py:35
    And I press increase power button         # sismic/bdd/wrappers.py:35
    When I press start button                 # sismic/bdd/wrappers.py:39
    Then heating turns on                     # None

  Scenario: Stop cooking food              # docs/examples/microwave/cooking_human.feature:12
    Given I reproduce "Start cooking food" # sismic/bdd/steps.py:11
    When 2 seconds elapsed                 # sismic/bdd/wrappers.py:39
    Then variable timer equals 3           # sismic/bdd/steps.py:151
    When I press stop button               # sismic/bdd/wrappers.py:39
    Then variable timer equals 0           # sismic/bdd/steps.py:151
    And heating turns off                  # sismic/bdd/wrappers.py:59
      Assertion Failed: UNDEFINED SUB-STEP: Then Event heating_off is fired


  Scenario: Cooking stops after preset time  # docs/examples/microwave/cooking_human.feature:20
    Given I reproduce "Start cooking food"   # sismic/bdd/steps.py:11
    When 5 seconds elapsed                   # sismic/bdd/wrappers.py:39
    Then variable timer equals 0             # sismic/bdd/steps.py:151
    And heating turns off                    # sismic/bdd/wrappers.py:59
      Assertion Failed: UNDEFINED SUB-STEP: Then Event heating_off is fired


Feature: Lighting # docs/examples/microwave/lighting_human.feature:1

  Scenario: Lamp is on when door is open  # docs/examples/microwave/lighting_human.feature:3
    When I open the door                  # sismic/bdd/wrappers.py:39
    Then lamp turns on                    # sismic/bdd/wrappers.py:59
      Assertion Failed: UNDEFINED SUB-STEP: Then Event lamp_switch_on is fired


  Scenario: Lamp is off when door is closed          # docs/examples/microwave/lighting_human.feature:7
    Given I reproduce "Lamp is on when door is open" # sismic/bdd/steps.py:11
    When I close the door                            # sismic/bdd/wrappers.py:39
    Then lamp turns off                              # sismic/bdd/wrappers.py:59
      Assertion Failed: UNDEFINED SUB-STEP: Then Event lamp_switch_off is fired


  Scenario: Lamp is on while cooking          # docs/examples/microwave/lighting_human.feature:12
    Given I open the door                     # sismic/bdd/wrappers.py:35
    And I place an item in the oven           # sismic/bdd/wrappers.py:35
    And I close the door                      # sismic/bdd/wrappers.py:35
    And I press increase timer button 5 times # sismic/bdd/wrappers.py:35
    When I press start button                 # sismic/bdd/wrappers.py:39
    Then lamp turns on                        # sismic/bdd/wrappers.py:59
      Assertion Failed: UNDEFINED SUB-STEP: Then Event lamp_switch_on is fired


  Scenario: Lamp turns off after cooking         # docs/examples/microwave/lighting_human.feature:20
    Given I reproduce "Lamp is on while cooking" # sismic/bdd/steps.py:11
    When I press stop button                     # sismic/bdd/wrappers.py:39
    Then lamp turns off                          # sismic/bdd/wrappers.py:59
      Assertion Failed: UNDEFINED SUB-STEP: Then Event lamp_switch_off is fired


Feature: Safety criterion # docs/examples/microwave/safety_human.feature:1

  Background: Start cooking food  # docs/examples/microwave/safety_human.feature:3

  Scenario: NO cooking when door is not closed  # docs/examples/microwave/safety_human.feature:9
    Given I open the door                       # sismic/bdd/wrappers.py:35
    And I place an item in the oven             # sismic/bdd/wrappers.py:35
    And I close the door                        # sismic/bdd/wrappers.py:35
    And I press increase timer button 5 times   # sismic/bdd/wrappers.py:35
    Given I open the door                       # sismic/bdd/wrappers.py:35
    When I press start button                   # sismic/bdd/wrappers.py:39
    Then heating does not turn on               # None

  Scenario: Opening door interrupts cooking   # docs/examples/microwave/safety_human.feature:14
    Given I open the door                     # sismic/bdd/wrappers.py:35
    And I place an item in the oven           # sismic/bdd/wrappers.py:35
    And I close the door                      # sismic/bdd/wrappers.py:35
    And I press increase timer button 5 times # sismic/bdd/wrappers.py:35
    Given I press start button                # sismic/bdd/wrappers.py:35
    And 3 seconds elapsed                     # sismic/bdd/wrappers.py:35
    When I open the door                      # sismic/bdd/wrappers.py:39
    Then heating turns off                    # sismic/bdd/wrappers.py:59
      Assertion Failed: UNDEFINED SUB-STEP: Then Event heating_off is fired



Failing scenarios:
  docs/examples/microwave/cooking_human.feature:12  Stop cooking food
  docs/examples/microwave/cooking_human.feature:20  Cooking stops after preset time
  docs/examples/microwave/lighting_human.feature:3  Lamp is on when door is open
  docs/examples/microwave/lighting_human.feature:7  Lamp is off when door is closed
  docs/examples/microwave/lighting_human.feature:12  Lamp is on while cooking
  docs/examples/microwave/lighting_human.feature:20  Lamp turns off after cooking
  docs/examples/microwave/safety_human.feature:14  Opening door interrupts cooking

Errored scenarios:
  docs
E70F
/examples/microwave/cooking_human.feature:3  Start cooking food
  docs/examples/microwave/safety_human.feature:9  NO cooking when door is not closed

0 features passed, 1 failed, 2 error, 0 skipped
0 scenarios passed, 7 failed, 2 error, 0 skipped
37 steps passed, 7 failed, 0 skipped, 2 undefined
Took 0m0.037s
----------------------------- Captured stderr call -----------------------------

You can implement step definitions for undefined steps with these snippets:

from behave.api.pending_step import StepNotImplementedError
@then(u'heating turns on')
def step_impl(context):
    raise StepNotImplementedError(u'STEP: Then heating turns on')


@then(u'Event heating_off is fired')
def step_impl(context):
    raise StepNotImplementedError(u'STEP: Then Event heating_off is fired')


@then(u'Event lamp_switch_on is fired')
def step_impl(context):
    raise StepNotImplementedError(u'STEP: Then Event lamp_switch_on is fired')


@then(u'Event lamp_switch_off is fired')
def step_impl(context):
    raise StepNotImplementedError(u'STEP: Then Event lamp_switch_off is fired')


@then(u'heating does not turn on')
def step_impl(context):
    raise StepNotImplementedError(u'STEP: Then heating does not turn on')


______________ TestMicrowave.test_microwave_with_steps[contract] _______________

self = <tests.test_bdd.TestMicrowave object at 0x104d61160>
microwave = Interpreter(Statechart('Microwave controller with contracts'))

    def test_microwave_with_steps(self, microwave):
        features = ['cooking_human', 'lighting_human', 'safety_human']
    
>       assert 0 == execute_bdd(
            microwave.statechart,
            [os.path.join('docs', 'examples', 'microwave', f+'.feature') for f in features],
            step_filepaths=[os.path.join('docs', 'examples', 'microwave', 'steps.py')],
        )
E       AssertionError: assert 0 == 1
E        +  where 1 = execute_bdd(Statechart('Microwave controller with contracts'), ['docs/examples/microwave/cooking_human.feature', 'docs/examples/microwave/lighting_human.featu
re', 'docs/examples/microwave/safety_human.feature'], step_filepaths=['docs/examples/microwave/steps.py'])
E        +    where Statechart('Microwave controller with contracts') = Interpreter(Statechart('Microwave controller with contracts')).statechart

tests/test_bdd.py:44: AssertionError
----------------------------- Captured stdout call -----------------------------
USING RUNNER: behave.runner:Runner
Feature: Cooking # docs/examples/microwave/cooking_human.feature:1

  Scenario: Start cooking food                # docs/examples/microwave/cooking_human.feature:3
    Given I open the door                     # sismic/bdd/wrappers.py:35
    And I place an item in the oven           # sismic/bdd/wrappers.py:35
    And I close the door                      # sismic/bdd/wrappers.py:35
    And I press increase timer button 5 times # sismic/bdd/wrappers.py:35
    And I press increase power button         # sismic/bdd/wrappers.py:35
    When I press start button                 # sismic/bdd/wrappers.py:39
    Then heating turns on                     # None

  Scenario: Stop cooking food              # docs/examples/microwave/cooking_human.feature:12
    Given I reproduce "Start cooking food" # sismic/bdd/steps.py:11
    When 2 seconds elapsed                 # sismic/bdd/wrappers.py:39
    Then variable timer equals 3           # sismic/bdd/steps.py:151
    When I press stop button               # sismic/bdd/wrappers.py:39
    Then variable timer equals 0           # sismic/bdd/steps.py:151
    And heating turns off                  # sismic/bdd/wrappers.py:59
      Assertion Failed: UNDEFINED SUB-STEP: Then Event heating_off is fired


  Scenario: Cooking stops after preset time  # docs/examples/microwave/cooking_human.feature:20
    Given I reproduce "Start cooking food"   # sismic/bdd/steps.py:11
    When 5 seconds elapsed                   # sismic/bdd/wrappers.py:39
    Then variable timer equals 0             # sismic/bdd/steps.py:151
    And heating turns off                    # sismic/bdd/wrappers.py:59
      Assertion Failed: UNDEFINED SUB-STEP: Then Event heating_off is fired


Feature: Lighting # docs/examples/microwave/lighting_human.feature:1

  Scenario: Lamp is on when door is open  # docs/examples/microwave/lighting_human.feature:3
    When I open the door                  # sismic/bdd/wrappers.py:39
    Then lamp turns on                    # sismic/bdd/wrappers.py:59
      Assertion Failed: UNDEFINED SUB-STEP: Then Event lamp_switch_on is fired


  Scenario: Lamp is off when door is closed          # docs/examples/microwave/lighting_human.feature:7
    Given I reproduce "Lamp is on when door is open" # sismic/bdd/steps.py:11
    When I close the door                            # sismic/bdd/wrappers.py:39
    Then lamp turns off                              # sismic/bdd/wrappers.py:59
      Assertion Failed: UNDEFINED SUB-STEP: Then Event lamp_switch_off is fired


  Scenario: Lamp is on while cooking          # docs/examples/microwave/lighting_human.feature:12
    Given I open the door                     # sismic/bdd/wrappers.py:35
    And I place an item in the oven           # sismic/bdd/wrappers.py:35
    And I close the door                      # sismic/bdd/wrappers.py:35
    And I press increase timer button 5 times # sismic/bdd/wrappers.py:35
    When I press start button                 # sismic/bdd/wrappers.py:39
    Then lamp turns on                        # sismic/bdd/wrappers.py:59
      Assertion Failed: UNDEFINED SUB-STEP: Then Event lamp_switch_on is fired


  Scenario: Lamp turns off after cooking         # docs/examples/microwave/lighting_human.feature:20
    Given I reproduce "Lamp is on while cooking" # sismic/bdd/steps.py:11
    When I press stop button                     # sismic/bdd/wrappers.py:39
    Then lamp turns off                          # sismic/bdd/wrappers.py:59
      Assertion Failed: UNDEFINED SUB-STEP: Then Event lamp_switch_off is fired


Feature: Safety criterion # docs/examples/microwave/safety_human.feature:1

  Background: Start cooking food  # docs/examples/microwave/safety_human.feature:3

  Scenario: NO cooking when door is not closed  # docs/examples/microwave/safety_human.feature:9
    Given I open the door                       # sismic/bdd/wrappers.py:35
    And I place an item in the oven             # sismic/bdd/wrappers.py:35
    And I close the door                        # sismic/bdd/wrappers.py:35
    And I press increase timer button 5 times   # sismic/bdd/wrappers.py:35
    Given I open the door                       # sismic/bdd/wrappers.py:35
    When I press start button                   # sismic/bdd/wrappers.py:39
    Then heating does not turn on               # None

  Scenario: Opening door interrupts cooking   # docs/examples/microwave/safety_human.feature:14
    Given I open the door                     # sismic/bdd/wrappers.py:35
    And I place an item in the oven           # sismic/bdd/wrappers.py:35
    And I close the door                      # sismic/bdd/wrappers.py:35
    And I press increase timer button 5 times # sismic/bdd/wrappers.py:35
    Given I press start button                # sismic/bdd/wrappers.py:35
    And 3 seconds elapsed                     # sismic/bdd/wrappers.py:35
    When I open the door                      # sismic/bdd/wrappers.py:39
    Then heating turns off                    # sismic/bdd/wrappers.py:59
      Assertion Failed: UNDEFINED SUB-STEP: Then Event heating_off is fired



Failing scenarios:
  docs/examples/microwave/cooking_human.feature:12  Stop cooking food
  docs/examples/microwave/cooking_human.feature:20  Cooking stops after preset time
  docs/examples/microwave/lighting_human.feature:3  Lamp is on when door is open
  docs/examples/microwave/lighting_human.feature:7  Lamp is off when door is closed
  docs/examples/microwave/lighting_human.feature:12  Lamp is on while cooking
  docs/examples/microwave/lighting_human.feature:20  Lamp turns off after cooking
  docs/examples/microwave/safety_human.feature:14  Opening door interrupts cooking

Errored scenarios:
  docs/examples/microwave/cooking_human.feature:3  Start cooking food
  docs/examples/microwave/safety_human.feature:9  NO cooking when door is not closed

0 features passed, 1 failed, 2 error, 0 skipped
0 scenarios passed, 7 failed, 2 error, 0 skipped
37 steps passed, 7 failed, 0 skipped, 2 undefined
Took 0m0.037s
----------------------------- Captured stderr call -----------------------------

You can implement step definitions for undefined steps with these snippets:

from behave.api.pending_step import StepNotImplementedError
@then(u'heating turns on')
def step_impl(context):
    raise StepNotImplementedError(u'STEP: Then heating turns on')


@then(u'Event heating_off is fired')
def step_impl(context):
    raise StepNotImplementedError(u'STEP: Then Event heating_off is fired')


@then(u'Event lamp_switch_on is fired')
def step_impl(context):
    raise StepNotImplementedError(u'STEP: Then Event lamp_switch_on is fired')


@then(u'Event lamp_switch_off is fired')
def step_impl(context):
    raise StepNotImplementedError(u'STEP: Then Event lamp_switch_off is fired')


@then(u'heating does not turn on')
def step_impl(context):
    raise StepNotImplementedError(u'STEP: Then heating does not turn on')


_____ TestMicrowave.test_microwave_with_steps_and_properties[no contract] ______

self = <tests.test_bdd.TestMicrowave object at 0x104d61250>
microwave = Interpreter(Statechart('Microwave controller'))
property_statecharts = [Statechart('Heating must stop when door is opened'), Statechart('Heating does not start if door is opened'), Statechart('Heating must not occur if/when door
 is opened')]

    def test_microwave_with_steps_and_properties(self, microwave, property_statecharts):
        features = ['cooking_human', 'lighting_human', 'safety_human']
    
>       assert 0 == execute_bdd(
            microwave.statechart,
            [os.path.join('docs', 'examples', 'microwave', f+'.feature') for f in features],
            step_filepaths=[os.path.join('docs', 'examples', 'microwave', 'steps.py')],
            property_statecharts=property_statecharts
        )
E       AssertionError: assert 0 == 1
E        +  where 1 = execute_bdd(Statechart('Microwave controller'), ['docs/examples/microwave/cooking_human.feature', 'docs/examples/microwave/lighting_human.feature', 'docs/exam
ples/microwave/safety_human.feature'], step_filepaths=['docs/examples/microwave/steps.py'], property_statecharts=[Statechart('Heating must stop when door is opened'), Statechart('H
eating does not start if door is opened'), Statechart('Heating must not occur if/when door is opened')])
E        +    where Statechart('Microwave controller') = Interpreter(Statechart('Microwave controller')).statechart

tests/test_bdd.py:53: AssertionError
----------------------------- Captured stdout call -----------------------------
USING RUNNER: behave.runner:Runner
Feature: Cooking # docs/examples/microwave/cooking_human.feature:1

  Scenario: Start cooking food                # docs/examples/microwave/cooking_human.feature:3
    Given I open the door                     # sismic/bdd/wrappers.py:35
    And I place an item in the oven           # sismic/bdd/wrappers.py:35
    And I close the door                      # sismic/bdd/wrappers.py:35
    And I press increase timer button 5 times # sismic/bdd/wrappers.py:35
    And I press increase power button         # sismic/bdd/wrappers.py:35
    When I press start button                 # sismic/bdd/wrappers.py:39
    Then heating turns on                     # None

  Scenario: Stop cooking food              # docs/examples/microwave/cooking_human.feature:12
    Given I reproduce "Start cooking food" # sismic/bdd/steps.py:11
    When 2 seconds elapsed                 # sismic/bdd/wrappers.py:39
    Then variable timer equals 3           # sismic/bdd/steps.py:151
    When I press stop button               # sismic/bdd/wrappers.py:39
    Then variable timer equals 0           # sismic/bdd/steps.py:151
    And heating turns off                  # sismic/bdd/wrappers.py:59
      Assertion Failed: UNDEFINED SUB-STEP: Then Event heating_off is fired


  Scenario: Cooking stops after preset time  # docs/examples/microwave/cooking_human.feature:20
    Given I reproduce "Start cooking food"   # sismic/bdd/steps.py:11
    When 5 seconds elapsed                   # sismic/bdd/wrappers.py:39
    Then variable timer equals 0             # sismic/bdd/steps.py:151
    And heating turns off                    # sismic/bdd/wrappers.py:59
      Assertion Failed: UNDEFINED SUB-STEP: Then Event heating_off is fired


Feature: Lighting # docs/examples/microwave/lighting_human.feature:1

  Scenario: Lamp is on when door is open  # docs/examples/microwave/lighting_human.feature:3
    When I open the door                  # sismic/bdd/wrappers.py:39
    Then lamp turns on                    # sismic/bdd/wrappers.py:59
      Assertion Failed: UNDEFINED SUB-STEP: Then Event lamp_switch_on is fired


  Scenario: Lamp is off when door is closed          # docs/examples/microwave/lighting_human.feature:7
    Given I reproduce "Lamp is on when door is open" # sismic/bdd/steps.py:11
    When I close the door                            # sismic/bdd/wrappers.py:39
    Then lamp turns off                              # sismic/bdd/wrappers.py:59
      Assertion Failed: UNDEFINED SUB-STEP: Then Event lamp_switch_off is fired


  Scenario: Lamp is on while cooking          # docs/examples/microwave/lighting_human.feature:12
    Given I open the door                     # sismic/bdd/wrappers.py:35
    And I place an item in the oven           # sismic/bdd/wrappers.py:35
    And I close the door                      # sismic/bdd/wrappers.py:35
    And I press increase timer button 5 times # sismic/bdd/wrappers.py:35
    When I press start button                 # sismic/bdd/wrappers.py:39
    Then lamp turns on                        # sismic/bdd/wrappers.py:59
      Assertion Failed: UNDEFINED SUB-STEP: Then Event lamp_switch_on is fired


  Scenario: Lamp turns off after cooking         # docs/examples/microwave/lighting_human.feature:20
    Given I reproduce "Lamp is on while cooking" # sismic/bdd/steps.py:11
    When I press stop button                     # sismic/bdd/wrappers.py:39
    Then lamp turns off                          # sismic/bdd/wrappers.py:59
      Assertion Failed: UNDEFINED SUB-STEP: Then Event lamp_switch_off is fired


Feature: Safety criterion # docs/examples/microwave/safety_human.feature:1

  Background: Start cooking food  # docs/examples/microwave/safety_human.feature:3

  Scenario: NO cooking when door is not closed  # docs/examples/microwave/safety_human.feature:9
    Given I open the door                       # sismic/bdd/wrappers.py:35
    And I place an item in the oven             # sismic/bdd/wrappers.py:35
    And I close the door                        # sismic/bdd/wrappers.py:35
    And I press increase timer button 5 times   # sismic/bdd/wrappers.py:35
    Given I open the door                       # sismic/bdd/wrappers.py:35
    When I press start button                   # sismic/bdd/wrappers.py:39
    Then heating does not turn on               # None

  Scenario: Opening door interrupts cooking   # docs/examples/microwave/safety_human.feature:14
    Given I open the door                     # sismic/bdd/wrappers.py:35
    And I place an item in the oven           # sismic/bdd/wrappers.py:35
    And I close the door                      # sismic/bdd/wrappers.py:35
    And I press increase timer button 5 times # sismic/bdd/wrappers.py:35
    Given I press start button                # sismic/bdd/wrappers.py:35
    And 3 seconds elapsed                     # sismic/bdd/wrappers.py:35
    When I open the door                      # sismic/bdd/wrappers.py:39
    Then heating turns off                    # sismic/bdd/wrappers.py:59
      Assertion Failed: UNDEFINED SUB-STEP: Then Event heating_off is fired



Failing scenarios:
  docs/examples/microwave/cooking_human.feature:12  Stop cooking food
  docs/examples/microwave/cooking_human.feature:20  Cooking stops after preset time
  docs/examples/microwave/lighting_human.feature:3  Lamp is on when door is open
  docs/examples/microwave/lighting_human.feature:7  Lamp is off when door is closed
  docs/examples/microwave/lighting_human.feature:12  Lamp is on while cooking
  docs/examples/microwave/lighting_human.feature:20  Lamp turns off after cooking
  docs/examples/microwave/safety_human.feature:14  Opening door interrupts cooking

Errored scenarios:
  docs/examples/microwave/cooking_human.feature:3  Start cooking food
  docs/examples/microwave/safety_human.feature:9  NO cooking when door is not closed

0 features passed, 1 failed, 2 error, 0 skipped
0 scenarios passed, 7 failed, 2 error, 0 skipped
37 steps passed, 7 failed, 0 skipped, 2 undefined
Took 0m0.123s
----------------------------- Captured stderr call -----------------------------

You can implement step definitions for undefined steps with these snippets:

from behave.api.pending_step import StepNotImplementedError
@then(u'heating turns on')
def step_impl(context):
    raise StepNotImplementedError(u'STEP: Then heating turns on')


@then(u'Event heating_off is fired')
def step_impl(context):
    raise StepNotImplementedError(u'STEP: Then Event heating_off is fired')


@then(u'Event lamp_switch_on is fired')
def step_impl(context):
    raise StepNotImplementedError(u'STEP: Then Event lamp_switch_on is fired')


@then(u'Event lamp_switch_off is fired')
def step_impl(context):
    raise StepNotImplementedError(u'STEP: Then Event lamp_switch_off is fired')


@then(u'heating does not turn on')
def step_impl(context):
    raise StepNotImplementedError(u'STEP: Then heating does not turn on')


_______ TestMicrowave.test_microwave_with_steps_and_properties[contract] _______

self = <tests.test_bdd.TestMicrowave object at 0x104d613a0>
microwave = Interpreter(Statechart('Microwave controller with contracts'))
property_statecharts = [Statechart('Heating must stop when door is opened'), Statechart('Heating does not start if door is opened'), Statechart('Heating must not occur if/when door
 is opened')]

    def test_microwave_with_steps_and_properties(self, microwave, property_statecharts):
        features = ['cooking_human', 'lighting_human', 'safety_human']
    
>       assert 0 == execute_bdd(
            microwave.statechart,
            [os.path.join('docs', 'examples', 'microwave', f+'.feature') for f in features],
            step_filepaths=[os.path.join('docs', 'examples', 'microwave', 'steps.py')],
            property_statecharts=property_statecharts
        )
E       AssertionError: assert 0 == 1
E        +  where 1 = execute_bdd(Statechart('Microwave controller with contracts'), ['docs/examples/microwave/cooking_human.feature', 'docs/examples/microwave/lighting_human.featu
re', 'docs/examples/microwave/safety_human.feature'], step_filepaths=['docs/examples/microwave/steps.py'], property_statecharts=[Statechart('Heating must stop when door is opened')
, Statechart('Heating does not start if door is opened'), Statechart('Heating must not occur if/when door is opened')])
E        +    where Statechart('Microwave controller with contracts') = Interpreter(Statechart('Microwave controller with contracts')).statechart

tests/test_bdd.py:53: AssertionError
----------------------------- Captured stdout call -----------------------------
USING RUNNER: behave.runner:Runner
Feature: Cooking # docs/examples/microwave/cooking_human.feature:1

  Scenario: Start cooking food                # docs/examples/microwave/cooking_human.feature:3
    Given I open the door                     # sismic/bdd/wrappers.py:35
    And I place an item in the oven           # sismic/bdd/wrappers.py:35
    And I close the door                      # sismic/bdd/wrappers.py:35
    And I press increase timer button 5 times # sismic/bdd/wrappers.py:35
    And I press increase power button         # sismic/bdd/wrappers.py:35
    When I press start button                 # sismic/bdd/wrappers.py:39
    Then heating turns on                     # None

  Scenario: Stop cooking food              # docs/examples/microwave/cooking_human.feature:12
    Given I reproduce "Start cooking food" # sismic/bdd/steps.py:11
    When 2 seconds elapsed                 # sismic/bdd/wrappers.py:39
    Then variable timer equals 3           # sismic/bdd/steps.py:151
    When I press stop button               # sismic/bdd/wrappers.py:39
    Then variable timer equals 0           # sismic/bdd/steps.py:151
    And heating turns off                  # sismic/bdd/wrappers.py:59
      Assertion Failed: UNDEFINED SUB-STEP: Then Event heating_off is fired


  Scenario: Cooking stops after preset time  # docs/examples/microwave/cooking_human.feature:20
    Given I reproduce "Start cooking food"   # sismic/bdd/steps.py:11
    When 5 seconds elapsed                   # sismic/bdd/wrappers.py:39
    Then variable timer equals 0             # sismic/bdd/steps.py:151
    And heating turns off                    # sismic/bdd/wrappers.py:59
      Assertion Failed: UNDEFINED SUB-STEP: Then Event heating_off is fired


Feature: Lighting # docs/examples/microwave/lighting_human.feature:1

  Scenario: Lamp is on when door is open  # docs/examples/microwave/lighting_human.feature:3
    When I open the door                  # sismic/bdd/wrappers.py:39
    Then lamp turns on                    # sismic/bdd/wrappers.py:59
      Assertion Failed: UNDEFINED SUB-STEP: Then Event lamp_switch_on is fired


  Scenario: Lamp is off when door is closed          # docs/examples/microwave/lighting_human.feature:7
    Given I reproduce "Lamp is on when door is open" # sismic/bdd/steps.py:11
    When I close the door                            # sismic/bdd/wrappers.py:39
    Then lamp turns off                              # sismic/bdd/wrappers.py:59
      Assertion Failed: UNDEFINED SUB-STEP: Then Event lamp_switch_off is fired


  Scenario: Lamp is on while cooking          # docs/examples/microwave/lighting_human.feature:12
    Given I open the door                     # sismic/bdd/wrappers.py:35
    And I place an item in the oven           # sismic/bdd/wrappers.py:35
    And I close the door                      # sismic/bdd/wrappers.py:35
    And I press increase timer button 5 times # sismic/bdd/wrappers.py:35
    When I press start button                 # sismic/bdd/wrappers.py:39
    Then lamp turns on                        # sismic/bdd/wrappers.py:59
      Assertion Failed: UNDEFINED SUB-STEP: Then Event lamp_switch_on is fired


  Scenario: Lamp turns off after cooking         # docs/examples/microwave/lighting_human.feature:20
    Given I reproduce "Lamp is on while cooking" # sismic/bdd/steps.py:11
    When I press stop button                     # sismic/bdd/wrappers.py:39
    Then lamp turns off                          # sismic/bdd/wrappers.py:59
      Assertion Failed: UNDEFINED SUB-STEP: Then Event lamp_switch_off is fired


Feature: Safety criterion # docs/examples/microwave/safety_human.feature:1

  Background: Start cooking food  # docs/examples/microwave/safety_human.feature:3

  Scenario: NO cooking when door is not closed  # docs/examples/microwave/safety_human.feature:9
    Given I open the door                       # sismic/bdd/wrappers.py:35
    And I place an item in the oven             # sismic/bdd/wrappers.py:35
    And I close the door                        # sismic/bdd/wrappers.py:35
    And I press increase timer button 5 times   # sismic/bdd/wrappers.py:35
    Given I open the door                       # sismic/bdd/wrappers.py:35
    When I press start button                   # sismic/bdd/wrappers.py:39
    Then heating does not turn on               # None

  Scenario: Opening door interrupts cooking   # docs/examples/microwave/safety_human.feature:14
    Given I open the door                     # sismic/bdd/wrappers.py:35
    And I place an item in the oven           # sismic/bdd/wrappers.py:35
    And I close the door                      # sismic/bdd/wrappers.py:35
    And I press increase timer button 5 times # sismic/bdd/wrappers.py:35
    Given I press start button                # sismic/bdd/wrappers.py:35
    And 3 seconds elapsed                     # sismic/bdd/wrappers.py:35
    When I open the door                      # sismic/bdd/wrappers.py:39
    Then heating turns off                    # sismic/bdd/wrappers.py:59
      Assertion Failed: UNDEFINED SUB-STEP: Then Event heating_off is fired



Failing scenarios:
  docs/examples/microwave/cooking_human.feature:12  Stop cooking food
  docs/examples/microwave/cooking_human.feature:20  Cooking stops after preset time
  docs/examples/microwave/lighting_human.feature:3  Lamp is on when door is open
  docs/examples/microwave/lighting_human.feature:7  Lamp is off when door is closed
  docs/examples/microwave/lighting_human.feature:12  Lamp is on while cooking
  docs/examples/microwave/lighting_human.feature:20  Lamp turns off after cooking
  docs/examples/microwave/safety_human.feature:14  Opening door interrupts cooking

Errored scenarios:
  docs/examples/microwave/cooking_human.feature:3  Start cooking food
  docs/examples/microwave/safety_human.feature:9  NO cooking when door is not closed

0 features passed, 1 failed, 2 error, 0 skipped
0 scenarios passed, 7 failed, 2 error, 0 skipped
37 steps passed, 7 failed, 0 skipped, 2 undefined
Took 0m0.124s
----------------------------- Captured stderr call -----------------------------

You can implement step definitions for undefined steps with these snippets:

from behave.api.pending_step import StepNotImplementedError
@then(u'heating turns on')
def step_impl(context):
    raise StepNotImplementedError(u'STEP: Then heating turns on')


@then(u'Event heating_off is fired')
def step_impl(context):
    raise StepNotImplementedError(u'STEP: Then Event heating_off is fired')


@then(u'Event lamp_switch_on is fired')
def step_impl(context):
    raise StepNotImplementedError(u'STEP: Then Event lamp_switch_on is fired')


@then(u'Event lamp_switch_off is fired')
def step_impl(context):
    raise StepNotImplementedError(u'STEP: Then Event lamp_switch_off is fired')


@then(u'heating does not turn on')
def step_impl(context):
    raise StepNotImplementedError(u'STEP: Then heating does not turn on')


___________________________________ test_cli ___________________________________

    def test_cli():
>       assert 0 == cli([
            'docs/examples/microwave/microwave.yaml',
            '--features', 'docs/examples/microwave/heating.feature', 'docs/examples/microwave/cooking_human.feature', 'docs/examples/microwave/lighting_human.feature', 'docs/exampl
es/microwave/safety_human.feature',
            '--steps', 'docs/examples/microwave/steps.py',
            '--properties', 'docs/examples/microwave/heating_on_property.yaml', 'docs/examples/microwave/heating_off_property.yaml'
        ])
E       AssertionError: assert 0 == 1
E        +  where 1 = cli(['docs/examples/microwave/microwave.yaml', '--features', 'docs/examples/microwave/heating.feature', 'docs/examples/mic..._human.feature', 'docs/examples/m
icrowave/lighting_human.feature', 'docs/examples/microwave/safety_human.feature', ...])

tests/test_bdd.py:62: AssertionError
----------------------------- Captured stdout call -----------------------------
USING RUNNER: behave.runner:Runner
Feature: No heating if door is opened # docs/examples/microwave/heating.feature:1

  Scenario: No heating when nothing is done  # docs/examples/microwave/heating.feature:3
    When I do nothing                        # sismic/bdd/steps.py:5
    Then event heating_on is not fired       # sismic/bdd/steps.py:134

  Scenario: No heating when I open the door  # docs/examples/microwave/heating.feature:7
    When I send event door_opened            # sismic/bdd/steps.py:39
    Then event heating_on is not fired       # sismic/bdd/steps.py:134

  Scenario: No heating when item is placed  # docs/examples/microwave/heating.feature:11
    Given I send event door_opened          # sismic/bdd/steps.py:39
    When I send event item_placed           # sismic/bdd/steps.py:39
    Then event heating_on is not fired      # sismic/bdd/steps.py:134

  Scenario: No heating when door is not closed  # docs/examples/microwave/heating.feature:16
    Given I send event door_opened              # sismic/bdd/steps.py:39
    And I send event item_placed                # sismic/bdd/steps.py:39
    When I send event door_closed               # sismic/bdd/steps.py:39
    Then event heating_on is not fired          # sismic/bdd/steps.py:134

  Scenario: Allow heating if door is closed  # docs/examples/microwave/heating.feature:22
    Given I send event door_opened           # sismic/bdd/steps.py:39
    And I send event item_placed             # sismic/bdd/steps.py:39
    And I send event door_closed             # sismic/bdd/steps.py:39
    And I send event timer_inc               # sismic/bdd/steps.py:39
    When I send event cooking_start          # sismic/bdd/steps.py:39
    Then event heating_on is fired           # sismic/bdd/steps.py:115

  Scenario: Opening door interrupts heating             # docs/examples/microwave/heating.feature:30
    Given I reproduce "Allow heating if door is closed" # sismic/bdd/steps.py:11
    When I send event door_opened                       # sismic/bdd/steps.py:39
    Then event heating_off is fired                     # sismic/bdd/steps.py:115

Feature: Cooking # docs/examples/microwave/cooking_human.feature:1

  Scenario: Start cooking food                # docs/examples/microwave/cooking_human.feature:3
    Given I open the door                     # sismic/bdd/wrappers.py:35
    And I place an item in the oven           # sismic/bdd/wrappers.py:35
    And I close the door                      # sismic/bdd/wrappers.py:35
    And I press increase timer button 5 times # sismic/bdd/wrappers.py:35
    And I press increase power button         # sismic/bdd/wrappers.py:35
    When I press start button                 # sismic/bdd/wrappers.py:39
    Then heating turns on                     # None

  Scenario: Stop cooking food              # docs/examples/microwave/cooking_human.feature:12
    Given I reproduce "Start cooking food" # sismic/bdd/steps.py:11
    When 2 seconds elapsed                 # sismic/bdd/wrappers.py:39
    Then variable timer equals 3           # sismic/bdd/steps.py:151
    When I press stop button               # sismic/bdd/wrappers.py:39
    Then variable timer equals 0           # sismic/bdd/steps.py:151
    And heating turns off                  # sismic/bdd/wrappers.py:59
      Assertion Failed: UNDEFINED SUB-STEP: Then Event heating_off is fired


  Scenario: Cooking stops after preset time  # docs/examples/microwave/cooking_human.feature:20
    Given I reproduce "Start cooking food"   # sismic/bdd/steps.py:11
    When 5 seconds elapsed                   # sismic/bdd/wrappers.py:39
    Then variable timer equals 0             # sismic/bdd/steps.py:151
    And heating turns off                    # sismic/bdd/wrappers.py:59
      Assertion Failed: UNDEFINED SUB-STEP: Then Event heating_off is fired


Feature: Lighting # docs/examples/microwave/lighting_human.feature:1

  Scenario: Lamp is on when door is open  # docs/examples/microwave/lighting_human.feature:3
    When I open the door                  # sismic/bdd/wrappers.py:39
    Then lamp turns on                    # sismic/bdd/wrappers.py:59
      Assertion Failed: UNDEFINED SUB-STEP: Then Event lamp_switch_on is fired


  Scenario: Lamp is off when door is closed          # docs/examples/microwave/lighting_human.feature:7
    Given I reproduce "Lamp is on when door is open" # sismic/bdd/steps.py:11
    When I close the door                            # sismic/bdd/wrappers.py:39
    Then lamp turns off                              # sismic/bdd/wrappers.py:59
      Assertion Failed: UNDEFINED SUB-STEP: Then Event lamp_switch_off is fired


  Scenario: Lamp is on while cooking          # docs/examples/microwave/lighting_human.feature:12
    Given I open the door                     # sismic/bdd/wrappers.py:35
    And I place an item in the oven           # sismic/bdd/wrappers.py:35
    And I close the door                      # sismic/bdd/wrappers.py:35
    And I press increase timer button 5 times # sismic/bdd/wrappers.py:35
    When I press start button                 # sismic/bdd/wrappers.py:39
    Then lamp turns on                        # sismic/bdd/wrappers.py:59
      Assertion Failed: UNDEFINED SUB-STEP: Then Event lamp_switch_on is fired


  Scenario: Lamp turns off after cooking         # docs/examples/microwave/lighting_human.feature:20
    Given I reproduce "Lamp is on while cooking" # sismic/bdd/steps.py:11
    When I press stop button                     # sismic/bdd/wrappers.py:39
    Then lamp turns off                          # sismic/bdd/wrappers.py:59
      Assertion Failed: UNDEFINED SUB-STEP: Then Event lamp_switch_off is fired


Feature: Safety criterion # docs/examples/microwave/safety_human.feature:1

  Background: Start cooking food  # docs/examples/microwave/safety_human.feature:3

  Scenario: NO cooking when door is not closed  # docs/examples/microwave/safety_human.feature:9
    Given I open the door                       # sismic/bdd/wrappers.py:35
    And I place an item in the oven             # sismic/bdd/wrappers.py:35
    And I close the door                        # sismic/bdd/wrappers.py:35
    And I press increase timer button 5 times   # sismic/bdd/wrappers.py:35
    Given I open the door                       # sismic/bdd/wrappers.py:35
    When I press start button                   # sismic/bdd/wrappers.py:39
    Then heating does not turn on               # None

  Scenario: Opening door interrupts cooking   # docs/examples/microwave/safety_human.feature:14
    Given I open the door                     # sismic/bdd/wrappers.py:35
    And I place an item in the oven           # sismic/bdd/wrappers.py:35
    And I close the door                      # sismic/bdd/wrappers.py:35
    And I press increase timer button 5 times # sismic/bdd/wrappers.py:35
    Given I press start button                # sismic/bdd/wrappers.py:35
    And 3 seconds elapsed                     # sismic/bdd/wrappers.py:35
    When I open the door                      # sismic/bdd/wrappers.py:39
    Then heating turns off                    # sismic/bdd/wrappers.py:59
      Assertion Failed: UNDEFINED SUB-STEP: Then Event heating_off is fired



Failing scenarios:
  docs/examples/microwave/cooking_human.feature:12  Stop cooking food
  docs/examples/microwave/cooking_human.feature:20  Cooking stops after preset time
  docs/examples/microwave/lighting_human.feature:3  Lamp is on when door is open
  docs/examples/microwave/lighting_human.feature:7  Lamp is off when door is closed
  docs/examples/microwave/lighting_human.feature:12  Lamp is on while cooking
  docs/examples/microwave/lighting_human.feature:20  Lamp turns off after cooking
  docs/examples/microwave/safety_human.feature:14  Opening door interrupts cooking

Errored scenarios:
  docs/examples/microwave/cooking_human.feature:3  Start cooking food
  docs/examples/microwave/safety_human.feature:9  NO cooking when door is not closed

1 feature passed, 1 failed, 2 error, 0 skipped
6 scenarios passed, 7 failed, 2 error, 0 skipped
57 steps passed, 7 failed, 0 skipped, 2 undefined
Took 0m0.100s
----------------------------- Captured stderr call -----------------------------

You can implement step definitions for undefined steps with these snippets:

from behave.api.pending_step import StepNotImplementedError
@then(u'heating turns on')
def step_impl(context):
    raise StepNotImplementedError(u'STEP: Then heating turns on')


@then(u'Event heating_off is fired')
def step_impl(context):
    raise StepNotImplementedError(u'STEP: Then Event heating_off is fired')


@then(u'Event lamp_switch_on is fired')
def step_impl(context):
    raise StepNotImplementedError(u'STEP: Then Event lamp_switch_on is fired')


@then(u'Event lamp_switch_off is fired')
def step_impl(context):
    raise StepNotImplementedError(u'STEP: Then Event lamp_switch_off is fired')


@then(u'heating does not turn on')
def step_impl(context):
    raise StepNotImplementedError(u'STEP: Then heating does not turn on')


=========================== short test summary info ============================
FAILED tests/test_bdd.py::TestMicrowave::test_microwave_with_steps[no contract] - AssertionError: assert 0 == 1
FAILED tests/test_bdd.py::TestMicrowave::test_microwave_with_steps[contract] - AssertionError: assert 0 == 1
FAILED tests/test_bdd.py::TestMicrowave::test_microwave_with_steps_and_properties[no contract] - AssertionError: assert 0 == 1
FAILED tests/test_bdd.py::TestMicrowave::test_microwave_with_steps_and_properties[contract] - AssertionError: assert 0 == 1
FAILED tests/test_bdd.py::test_cli - AssertionError: assert 0 == 1
=========== 5 failed, 327 passed, 12 deselected, 1 xpassed in 5.13s ============

These are not observed when running against 1.2.7.dev5.

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      0