-
Notifications
You must be signed in to change notification settings - Fork 6
/
doc.go
41 lines (34 loc) · 1.22 KB
/
doc.go
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
/*
Package gherkin implements a parser for the Gherkin language, used for
Story/Feature based Behavior Driven Development.
Basic usage example:
feature, _ := gherkin.ParseGherkinFeature(`
@wip
Feature: Hello World
The world is a beautiful place
So let people be nice to each other
@nice @people
Scenario: Nice people
Given a nice person called "Bob"
And a nice person called "Lisa"
When "Bob" says to "Lisa": "Hello!"
Then "Lisa" should reply to "Bob": "Hello!"
`)
fmt.Printf("feature: %#v %#v\n", feature.Title(), feature.Tags())
fmt.Printf("no. scenarios: %#v\n", len(feature.Scenarios()))
for i, scenario := range feature.Scenarios() {
fmt.Printf("scenario %d: %#v %#v\n", i+1, scenario.Title(), scenario.Tags())
for i, step := range scenario.Steps() {
fmt.Printf(" step %d: %#v %#v\n", i+1, step.StepType(), step.Text())
}
}
Output:
feature: "Hello World" []string{"wip"}
no. scenarios: 1
scenario 1: "Nice people" []string{"nice", "people"}
step 1: "Given" "a nice person called \"Bob\""
step 2: "And" "a nice person called \"Lisa\""
step 3: "When" "\"Bob\" says to \"Lisa\": \"Hello!\""
step 4: "Then" "\"Lisa\" should reply to \"Bob\": \"Hello!\""
*/
package gherkin