- Notifications
You must be signed in to change notification settings - Fork6
Go Package gherkin implements a parser for the Gherkin language, used for Story/Feature based Behavior Driven Development.
License
NotificationsYou must be signed in to change notification settings
muhqu/go-gherkin
Folders and files
Name | Name | Last commit message | Last commit date | |
---|---|---|---|---|
Repository files navigation
Package gherkin implements a parser for the Gherkin language, used forStory/Feature based Behavior Driven Development.
The parser is generated via@pointlander's awesomepeg parser generator.
Read theDocumentation over atgodoc.org.
$ go get github.com/muhqu/go-gherkin
$ git clone https://github.com/muhqu/go-gherkin...$cd go-gherkin/$ make get-deps buildtest install
import ("github.com/muhqu/go-gherkin")funcmain() {feature,_:=gherkin.ParseGherkinFeature(`@wipFeature: 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()))fori,scenario:=rangefeature.Scenarios() {fmt.Printf("scenario %d: %#v %#v\n",i+1,scenario.Title(),scenario.Tags())fori,step:=rangescenario.Steps() {fmt.Printf(" step %d: %#v %#v\n",i+1,step.StepType(),step.Text()) } }}
Output:
feature: "Hello World" []string{"wip"}no. scenarios: 1scenario 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!\""
Projects using go-gherkin package:
- gherkinfmt - Commandline tool to format Gherkin files.
© 2014 by Mathias Leppich github.com/muhqu,@muhqu | |
About
Go Package gherkin implements a parser for the Gherkin language, used for Story/Feature based Behavior Driven Development.
Resources
License
Stars
Watchers
Forks
Packages0
No packages published