File: issue0228.feature

package info (click to toggle)
behave 1.2.6-6
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 4,160 kB
  • sloc: python: 19,857; makefile: 137; sh: 18
file content (41 lines) | stat: -rw-r--r-- 1,286 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
@feature_request
@issue
Feature: Issue #228: Allow before_scenario to determine whether steps should be run.

  Allow before_scenario to call mark_skipped() and early out if the current
  scenario should be skipped.

  Scenario: Allow before_scenario to skip the current scenario

    Given a new working directory
    And a file named "features/steps/steps.py" with:
        """
        from behave import step

        @step('a step passes')
        def step_passes(context):
            pass
        """
    And a file named "features/environment.py" with
        """
        def before_scenario(context, scenario):
            if scenario.name == 'Skip this scenario':
                scenario.skip()
        """
    And a file named "features/issue228_example.feature" with
        """
        Feature:
          Scenario: Skip this scenario
            Given I'm using an "undefined step"

          Scenario: Run this scenario
            Given a step passes
        """
    When I run "behave -f plain features/issue228_example.feature"
    Then it should pass
     And the command output should contain:
        """
        1 feature passed, 0 failed, 0 skipped
        1 scenario passed, 0 failed, 1 skipped
        1 step passed, 0 failed, 1 skipped, 0 undefined
        """