Sha256: 4c89e65471c6c2537d4701b5c67a5061448e32d7f6a5b8f83915e8da936fd873

Contents?: true

Size: 1.42 KB

Versions: 6

Compression:

Stored size: 1.42 KB

Contents

Feature: AfterStep Hooks
  AfterStep hooks can be used to further inspect the Step object of the step
  that has just run, or to simply check the step's result.

  Background:
    Given the standard step definitions
    And a file named "features/sample.feature" with:
      """
      Feature: Sample

        Scenario: Success
          Given this step passes
      """

  Scenario: Access Test Step object in AfterStep Block
    Given a file named "features/support/env.rb" with:
      """
      AfterStep do |result, test_step|
        expect(test_step).to be_a(Cucumber::Core::Test::Step)
      end
      """
    When I run `cucumber features`
    Then it should pass with:
      """
      Feature: Sample

        Scenario: Success        # features/sample.feature:3
          Given this step passes # features/step_definitions/steps.rb:1

      1 scenario (1 passed)
      1 step (1 passed)

      """

  Scenario: An AfterStep with one named argument receives only the result
    Given a file named "features/support/env.rb" with:
      """
      AfterStep do |result|
        expect(result).to be_a(Cucumber::Core::Test::Result::Passed)
      end
      """
    When I run `cucumber features`
    Then it should pass with:
      """
      Feature: Sample

        Scenario: Success        # features/sample.feature:3
          Given this step passes # features/step_definitions/steps.rb:1

      1 scenario (1 passed)
      1 step (1 passed)

      """

Version data entries

6 entries across 6 versions & 2 rubygems

Version Path
cucumber-2.99.0 features/docs/writing_support_code/after_step_hooks.feature
mobiusloop-0.1.5 features/docs/writing_support_code/after_step_hooks.feature
cucumber-3.0.0.pre.1 features/docs/writing_support_code/after_step_hooks.feature
cucumber-2.4.0 features/docs/writing_support_code/after_step_hooks.feature
mobiusloop-0.1.3 features/docs/writing_support_code/after_step_hooks.feature
mobiusloop-0.1.2 features/docs/writing_support_code/after_step_hooks.feature