godog/gherkin/README.md
2015-06-23 14:26:30 +03:00

50 строки
1,5 КиБ
Markdown

[![Build Status](https://travis-ci.org/DATA-DOG/godog.png)](https://travis-ci.org/DATA-DOG/godog)
[![GoDoc](https://godoc.org/github.com/DATA-DOG/godog/gherkin?status.svg)](https://godoc.org/github.com/DATA-DOG/godog/gherkin)
# Gherkin Parser for GO
Package gherkin is a gherkin language parser based on [specification][gherkin]
specification. It parses a feature file into the it's structural representation. It also
creates an AST tree of gherkin Tokens read from the file.
With gherkin language you can describe your application behavior as features in
human-readable and machine friendly language.
``` go
package main
import (
"log"
"os"
"github.com/DATA-DOG/godog/gherkin"
)
func main() {
feature, err := gherkin.ParseFile("ls.feature")
switch {
case err == gherkin.ErrEmpty:
log.Println("the feature file is empty and does not describe any feature")
return
case err != nil:
log.Fatalln("the feature file is incorrect or could not be read:", err)
}
log.Println("have parsed a feature:", feature.Title, "with", len(feature.Scenarios), "scenarios")
}
```
### Documentation
See [godoc][godoc].
The public API is stable enough, but it may break until **1.0.0** version, see `godog --version`.
Has no external dependencies.
### License
Licensed under the [three clause BSD license][license]
[godoc]: http://godoc.org/github.com/DATA-DOG/godog/gherkin "Documentation on godoc for gherkin"
[gherkin]: https://cucumber.io/docs/reference "Gherkin feature file language"
[license]: http://en.wikipedia.org/wiki/BSD_licenses "The three clause BSD license"