Sha256: 6b3dbd6ab37f5762a678a5b049efba1ade4779950d6e0656145408b74292d8ef

Contents?: true

Size: 1.23 KB

Versions: 18

Compression:

Stored size: 1.23 KB

Contents

Feature: Randomize

  Use the `--order random` switch to run scenarios in random order.

  This is especially helpful for detecting situations where you have state
  leaking between scenarios, which can cause flickering or fragile tests.

  If you do find a randmon run that exposes dependencies between your tests,
  you can reproduce that run by using the seed that's printed at the end of
  the test run.

  Background:
    Given a file named "features/bad_practice.feature" with:
      """
      Feature: Bad practice
        
        Scenario: Set state
          Given I set some state
      
        Scenario: Depend on state
          When I depend on the state
      """
    And a file named "features/step_definitions/steps.rb" with:
      """
      Given(/^I set some state$/) do
        $global_state = "set"
      end

      Given(/^I depend on the state$/) do
        raise "I expect the state to be set!" unless $global_state == "set"
      end
      """

  Scenario: Run scenarios in order
    When I run `cucumber`
    Then it should pass

  @spawn
  Scenario: Run scenarios randomized
    When I run `cucumber --order random:41515`
    Then it should fail
    And the stdout should contain:
      """
      Randomized with seed 41515
      """

Version data entries

18 entries across 18 versions & 1 rubygems

Version Path
cucumber-2.3.2 features/docs/cli/randomize.feature
cucumber-2.3.1 features/docs/cli/randomize.feature
cucumber-2.3.0 features/docs/cli/randomize.feature
cucumber-2.2.0 features/docs/cli/randomize.feature
cucumber-2.1.0 features/docs/cli/randomize.feature
cucumber-2.0.2 features/docs/cli/randomize.feature
cucumber-2.0.1 features/docs/cli/randomize.feature
cucumber-2.0.0 features/docs/cli/randomize.feature
cucumber-2.0.0.rc.5 features/docs/cli/randomize.feature
cucumber-2.0.0.rc.4 features/docs/cli/randomize.feature
cucumber-2.0.0.rc.3 features/docs/cli/randomize.feature
cucumber-2.0.0.rc.2 features/docs/cli/randomize.feature
cucumber-2.0.0.rc.1 features/docs/cli/randomize.feature
cucumber-2.0.0.beta.5 features/docs/cli/randomize.feature
cucumber-2.0.0.beta.4 features/docs/cli/randomize.feature
cucumber-2.0.0.beta.3 features/docs/cli/randomize.feature
cucumber-2.0.0.beta.2 features/docs/cli/randomize.feature
cucumber-2.0.0.beta.1 features/docs/cli/randomize.feature