Contents

This page comes from an earlier version of the Cucumber Js docs (commit dcdc32d7). See the latest Cucumber Js docs.

Asynchronous failing steps

Scenario: see asynchronously failing scenarios

  • Given the following feature:
    Feature: a feature
      Scenario: a failing scenario
        When I divide 10 by 0
        Then the result is 9
  • And the step "I divide 10 by 0" has a mapping asynchronously failing with the message "Divide by 0, uh?"
  • When Cucumber runs the feature
  • Then the scenario called "a failing scenario" is reported as failing

Scenario: see asynchronously failing scenarios with exception

@untestable-on-self

  • Given the following feature:
    Feature: a feature
      Scenario: a failing scenario
        When I divide 10 by 0
        Then the result is 9
  • And the step "I divide 10 by 0" has a mapping asynchronously failing through an exception with the message "Divide by 0, uh?"
  • When Cucumber runs the feature
  • Then the scenario called "a failing scenario" is reported as failing

Source: features/asynchronous_failing_steps.feature at commit dcdc32d7, Cucumber Js (MIT license).