github.com/kat-co/gorkin@v0.0.0-20150628020237-0eebb48d172e/features/feature-runner.feature (about)

     1  Feature: Running Over Feature Files
     2    As a gorkin user
     3    I would like gorkin to run tests against feature files
     4    So that I can couple my requirements with my tests.
     5  
     6    Background:
     7      Given the path "./features" exists
     8      And the path "./features/steps" exists
     9  
    10    Scenario: A user runs gorkin without a features directory.
    11      Given the path "./features" doesn't exist
    12      When a user runs "gorkin"
    13      Then the output should be
    14      """
    15      could not find a features directory.
    16      """
    17  
    18    Scenario: A user runs gorkin with feature files and steps.
    19      Given the file "./features/foo.feature" exists
    20      And the file "./features/steps/foo_test.go" exists with content
    21      """
    22      package steps
    23  
    24      import (
    25          "testing"
    26  
    27          . "github.com/kat-co/gorkin/gorkin"
    28      )
    29  
    30      func Test(t *testing.T) {
    31          type I struct {}
    32          RunFeatureTests(t, &I{})
    33      }
    34      """
    35      When a user runs "gorkin"
    36      Then the output should contain
    37      """
    38      ok
    39      """
    40  
    41  
    42    Scenario: A user runs multiple scenarios with reusable steps.
    43      Given the file "./features/reusable-steps.feature" exists with content
    44      """
    45      Feature: Example Feature
    46  
    47        Scenario: Scenario A
    48          Given set state to "1"
    49          Then state should be "1"
    50  
    51        Scenario: Scenario B
    52          Then state should be "0"
    53      """
    54      And the file "./features/steps/step_test.go" exists with content
    55      """
    56      package gorkin
    57  
    58      import (
    59          "testing"
    60  
    61          . "github.com/kat-co/gorkin/gorkin"
    62      )
    63  
    64      func Test(t *testing.T) {
    65  
    66          type I struct {
    67              State int
    68          }
    69  
    70          Step(`set state to "([^"]+)"$`, func(i *I, state int) {
    71              i.State = state
    72          })
    73  
    74          Step(`state should be "([^"]+)"$`, func(i *I, state int) {
    75              if i.State != state {
    76                  t.Error("current state:", i.State)
    77                  t.Fatal("State is not", state)
    78              }
    79          })
    80  
    81          RunFeatureTests(t, &I{})
    82      }
    83      """
    84      When a user runs "gorkin"
    85      Then the output should contain
    86      """
    87      ok
    88      """