github.com/raarceoml/godog@v0.7.9/features/events.feature (about)

     1  Feature: suite events
     2    In order to run tasks before and after important events
     3    As a test suite
     4    I need to provide a way to hook into these events
     5  
     6    Background:
     7      Given I'm listening to suite events
     8  
     9    Scenario: triggers before scenario event
    10      Given a feature path "features/load.feature:6"
    11      When I run feature suite
    12      Then there was event triggered before scenario "load features within path"
    13  
    14    Scenario: triggers appropriate events for a single scenario
    15      Given a feature path "features/load.feature:6"
    16      When I run feature suite
    17      Then these events had to be fired for a number of times:
    18        | BeforeSuite    | 1 |
    19        | BeforeFeature  | 1 |
    20        | BeforeScenario | 1 |
    21        | BeforeStep     | 3 |
    22        | AfterStep      | 3 |
    23        | AfterScenario  | 1 |
    24        | AfterFeature   | 1 |
    25        | AfterSuite     | 1 |
    26  
    27    Scenario: triggers appropriate events whole feature
    28      Given a feature path "features/load.feature"
    29      When I run feature suite
    30      Then these events had to be fired for a number of times:
    31        | BeforeSuite    | 1  |
    32        | BeforeFeature  | 1  |
    33        | BeforeScenario | 6  |
    34        | BeforeStep     | 19 |
    35        | AfterStep      | 19 |
    36        | AfterScenario  | 6  |
    37        | AfterFeature   | 1  |
    38        | AfterSuite     | 1  |
    39  
    40    Scenario: triggers appropriate events for two feature files
    41      Given a feature path "features/load.feature:6"
    42      And a feature path "features/multistep.feature:6"
    43      When I run feature suite
    44      Then these events had to be fired for a number of times:
    45        | BeforeSuite    | 1 |
    46        | BeforeFeature  | 2 |
    47        | BeforeScenario | 2 |
    48        | BeforeStep     | 7 |
    49        | AfterStep      | 7 |
    50        | AfterScenario  | 2 |
    51        | AfterFeature   | 2 |
    52        | AfterSuite     | 1 |
    53  
    54    Scenario: should not trigger events on empty feature
    55      Given a feature "normal.feature" file:
    56        """
    57        Feature: empty
    58  
    59          Scenario: one
    60  
    61          Scenario: two
    62        """
    63      When I run feature suite
    64      Then these events had to be fired for a number of times:
    65        | BeforeSuite    | 1 |
    66        | BeforeFeature  | 0 |
    67        | BeforeScenario | 0 |
    68        | BeforeStep     | 0 |
    69        | AfterStep      | 0 |
    70        | AfterScenario  | 0 |
    71        | AfterFeature   | 0 |
    72        | AfterSuite     | 1 |
    73  
    74    Scenario: should not trigger events on empty scenarios
    75      Given a feature "normal.feature" file:
    76        """
    77        Feature: half empty
    78  
    79          Scenario: one
    80  
    81          Scenario: two
    82            Then passing step
    83  
    84          Scenario Outline: three
    85            Then passing step
    86  
    87            Examples:
    88              | a |
    89              | 1 |
    90        """
    91      When I run feature suite
    92      Then these events had to be fired for a number of times:
    93        | BeforeSuite    | 1 |
    94        | BeforeFeature  | 1 |
    95        | BeforeScenario | 2 |
    96        | BeforeStep     | 2 |
    97        | AfterStep      | 2 |
    98        | AfterScenario  | 2 |
    99        | AfterFeature   | 1 |
   100        | AfterSuite     | 1 |