github.com/lonnblad/godog@v0.7.14-0.20200306004719-1b0cb3259847/features/tags.feature (about)

     1  Feature: tag filters
     2    In order to test application behavior
     3    As a test suite
     4    I need to be able to filter features and scenarios by tags
     5  
     6    Scenario: should filter outline examples by tags
     7      Given a feature "normal.feature" file:
     8        """
     9        Feature: outline
    10  
    11          Background:
    12            Given passing step
    13  
    14          Scenario Outline: parse a scenario
    15            Given a feature path "<path>"
    16            When I parse features
    17            Then I should have <num> scenario registered
    18  
    19            Examples:
    20              | path                    | num |
    21              | features/load.feature:3 | 0   |
    22  
    23            @used
    24            Examples:
    25              | path                    | num |
    26              | features/load.feature:6 | 1   |
    27        """
    28      When I run feature suite with tags "@used"
    29      Then the suite should have passed
    30      And the following steps should be passed:
    31        """
    32        I parse features
    33        a feature path "features/load.feature:6"
    34        I should have 1 scenario registered
    35        """
    36      And I should have 1 scenario registered
    37  
    38    Scenario: should filter scenarios by X tag
    39      Given a feature "normal.feature" file:
    40        """
    41        Feature: tagged
    42  
    43          @x
    44          Scenario: one
    45            Given a feature path "one"
    46  
    47          @x
    48          Scenario: two
    49            Given a feature path "two"
    50  
    51          @x @y
    52          Scenario: three
    53            Given a feature path "three"
    54  
    55          @y
    56          Scenario: four
    57            Given a feature path "four"
    58        """
    59      When I run feature suite with tags "@x"
    60      Then the suite should have passed
    61      And I should have 3 scenario registered
    62      And the following steps should be passed:
    63        """
    64        a feature path "one"
    65        a feature path "two"
    66        a feature path "three"
    67        """
    68  
    69    Scenario: should filter scenarios by X tag not having Y
    70      Given a feature "normal.feature" file:
    71        """
    72        Feature: tagged
    73  
    74          @x
    75          Scenario: one
    76            Given a feature path "one"
    77  
    78          @x
    79          Scenario: two
    80            Given a feature path "two"
    81  
    82          @x @y
    83          Scenario: three
    84            Given a feature path "three"
    85  
    86          @y @z
    87          Scenario: four
    88            Given a feature path "four"
    89        """
    90      When I run feature suite with tags "@x && ~@y"
    91      Then the suite should have passed
    92      And I should have 2 scenario registered
    93      And the following steps should be passed:
    94        """
    95        a feature path "one"
    96        a feature path "two"
    97        """
    98  
    99    Scenario: should filter scenarios having Y and Z tags
   100      Given a feature "normal.feature" file:
   101        """
   102        Feature: tagged
   103  
   104          @x
   105          Scenario: one
   106            Given a feature path "one"
   107  
   108          @x
   109          Scenario: two
   110            Given a feature path "two"
   111  
   112          @x @y
   113          Scenario: three
   114            Given a feature path "three"
   115  
   116          @y @z
   117          Scenario: four
   118            Given a feature path "four"
   119        """
   120      When I run feature suite with tags "@y && @z"
   121      Then the suite should have passed
   122      And I should have 1 scenario registered
   123      And the following steps should be passed:
   124        """
   125        a feature path "four"
   126        """