Fixed the undefined step definitions help (#350)
Этот коммит содержится в:
родитель
027a1abf0e
коммит
7014a10e2f
12 изменённых файлов: 41 добавлений и 41 удалений
16
README.md
16
README.md
|
@ -138,10 +138,10 @@ func thereShouldBeRemaining(arg1 int) error {
|
|||
return godog.ErrPending
|
||||
}
|
||||
|
||||
func FeatureContext(s *godog.Suite) {
|
||||
s.Step(`^I eat (\d+)$`, iEat)
|
||||
s.Step(`^there are (\d+) godogs$`, thereAreGodogs)
|
||||
s.Step(`^there should be (\d+) remaining$`, thereShouldBeRemaining)
|
||||
func InitializeScenario(ctx *godog.ScenarioContext) {
|
||||
ctx.Step(`^I eat (\d+)$`, iEat)
|
||||
ctx.Step(`^there are (\d+) godogs$`, thereAreGodogs)
|
||||
ctx.Step(`^there should be (\d+) remaining$`, thereShouldBeRemaining)
|
||||
}
|
||||
```
|
||||
|
||||
|
@ -163,10 +163,10 @@ func thereShouldBeRemaining(arg1 int) error {
|
|||
return godog.ErrPending
|
||||
}
|
||||
|
||||
func FeatureContext(s *godog.Suite) {
|
||||
s.Step(`^I eat (\d+)$`, iEat)
|
||||
s.Step(`^there are (\d+) godogs$`, thereAreGodogs)
|
||||
s.Step(`^there should be (\d+) remaining$`, thereShouldBeRemaining)
|
||||
func InitializeScenario(ctx *godog.ScenarioContext) {
|
||||
ctx.Step(`^I eat (\d+)$`, iEat)
|
||||
ctx.Step(`^there are (\d+) godogs$`, thereAreGodogs)
|
||||
ctx.Step(`^there should be (\d+) remaining$`, thereShouldBeRemaining)
|
||||
}
|
||||
```
|
||||
|
||||
|
|
|
@ -14,7 +14,7 @@ import (
|
|||
var opts = godog.Options{Output: colors.Colored(os.Stdout)}
|
||||
|
||||
func init() {
|
||||
godog.BindCommandLineFlags("godog.", &opts)
|
||||
godog.BindFlags("godog.", flag.CommandLine, &opts)
|
||||
}
|
||||
|
||||
func TestMain(m *testing.M) {
|
||||
|
|
|
@ -13,7 +13,7 @@ import (
|
|||
var opts = godog.Options{Output: colors.Colored(os.Stdout)}
|
||||
|
||||
func init() {
|
||||
godog.BindCommandLineFlags("godog.", &opts)
|
||||
godog.BindFlags("godog.", flag.CommandLine, &opts)
|
||||
}
|
||||
|
||||
func TestMain(m *testing.M) {
|
||||
|
|
|
@ -287,8 +287,8 @@ Feature: pretty formatter
|
|||
return godog.ErrPending
|
||||
}
|
||||
|
||||
func FeatureContext(s *godog.Suite) {
|
||||
s.Step(`^undefined$`, undefined)
|
||||
func InitializeScenario(ctx *godog.ScenarioContext) {
|
||||
ctx.Step(`^undefined$`, undefined)
|
||||
}
|
||||
"""
|
||||
|
||||
|
|
|
@ -28,9 +28,9 @@ Feature: undefined step snippets
|
|||
return godog.ErrPending
|
||||
}
|
||||
|
||||
func FeatureContext(s *godog.Suite) {
|
||||
s.Step(`^I send "([^"]*)" request to "([^"]*)"$`, iSendRequestTo)
|
||||
s.Step(`^the response code should be (\d+)$`, theResponseCodeShouldBe)
|
||||
func InitializeScenario(ctx *godog.ScenarioContext) {
|
||||
ctx.Step(`^I send "([^"]*)" request to "([^"]*)"$`, iSendRequestTo)
|
||||
ctx.Step(`^the response code should be (\d+)$`, theResponseCodeShouldBe)
|
||||
}
|
||||
"""
|
||||
|
||||
|
@ -56,9 +56,9 @@ Feature: undefined step snippets
|
|||
return godog.ErrPending
|
||||
}
|
||||
|
||||
func FeatureContext(s *godog.Suite) {
|
||||
s.Step(`^I send "([^"]*)" request to "([^"]*)" with:$`, iSendRequestToWith)
|
||||
s.Step(`^the response code should be (\d+) and header "([^"]*)" should be "([^"]*)"$`, theResponseCodeShouldBeAndHeaderShouldBe)
|
||||
func InitializeScenario(ctx *godog.ScenarioContext) {
|
||||
ctx.Step(`^I send "([^"]*)" request to "([^"]*)" with:$`, iSendRequestToWith)
|
||||
ctx.Step(`^the response code should be (\d+) and header "([^"]*)" should be "([^"]*)"$`, theResponseCodeShouldBeAndHeaderShouldBe)
|
||||
}
|
||||
"""
|
||||
|
||||
|
@ -87,9 +87,9 @@ Feature: undefined step snippets
|
|||
return godog.ErrPending
|
||||
}
|
||||
|
||||
func FeatureContext(s *godog.Suite) {
|
||||
s.Step(`^I pull from github\.com$`, iPullFromGithubcom)
|
||||
s.Step(`^the project should be there$`, theProjectShouldBeThere)
|
||||
func InitializeScenario(ctx *godog.ScenarioContext) {
|
||||
ctx.Step(`^I pull from github\.com$`, iPullFromGithubcom)
|
||||
ctx.Step(`^the project should be there$`, theProjectShouldBeThere)
|
||||
}
|
||||
"""
|
||||
|
||||
|
@ -113,9 +113,9 @@ Feature: undefined step snippets
|
|||
return godog.ErrPending
|
||||
}
|
||||
|
||||
func FeatureContext(s *godog.Suite) {
|
||||
s.Step(`^I add the "([^"]*)" to the basket$`, iAddTheToTheBasket)
|
||||
s.Step(`^there is a "([^"]*)", which costs £(\d+)$`, thereIsAWhichCosts)
|
||||
func InitializeScenario(ctx *godog.ScenarioContext) {
|
||||
ctx.Step(`^I add the "([^"]*)" to the basket$`, iAddTheToTheBasket)
|
||||
ctx.Step(`^there is a "([^"]*)", which costs £(\d+)$`, thereIsAWhichCosts)
|
||||
}
|
||||
"""
|
||||
|
||||
|
@ -139,8 +139,8 @@ Feature: undefined step snippets
|
|||
return godog.ErrPending
|
||||
}
|
||||
|
||||
func FeatureContext(s *godog.Suite) {
|
||||
s.Step(`^(\d+) godogs$`, godogs)
|
||||
s.Step(`^"([^"]*)", which costs £(\d+)$`, whichCosts)
|
||||
func InitializeScenario(ctx *godog.ScenarioContext) {
|
||||
ctx.Step(`^(\d+) godogs$`, godogs)
|
||||
ctx.Step(`^"([^"]*)", which costs £(\d+)$`, whichCosts)
|
||||
}
|
||||
"""
|
||||
|
|
|
@ -49,7 +49,8 @@ func FlagSet(opt *Options) *flag.FlagSet {
|
|||
// BindFlags binds godog flags to given flag set prefixed
|
||||
// by given prefix, without overriding usage
|
||||
//
|
||||
// Deprecated: Use BindCommandLineFlags(prefix, &opts) instead of BindFlags(prefix, flag.CommandLine, &opts)
|
||||
// Deprecated: Use BindCommandLineFlags(prefix, &opts)
|
||||
// instead of BindFlags(prefix, flag.CommandLine, &opts)
|
||||
func BindFlags(prefix string, set *flag.FlagSet, opt *Options) {
|
||||
descFormatOption := "How to format tests output. Built-in formats:\n"
|
||||
// @TODO: sort by name
|
||||
|
|
|
@ -43,7 +43,6 @@ func init() {
|
|||
{{end}}
|
||||
|
||||
func main() {
|
||||
{{if or .TestSuiteContexts .ScenarioContexts .XTestSuiteContexts .XScenarioContexts}}
|
||||
status := godog.TestSuite{
|
||||
Name: "{{ .Name }}",
|
||||
TestSuiteInitializer: func (ctx *godog.TestSuiteContext) {
|
||||
|
@ -64,7 +63,7 @@ func main() {
|
|||
{{end}}
|
||||
},
|
||||
}.Run()
|
||||
{{end}}
|
||||
|
||||
os.Exit(status)
|
||||
}`))
|
||||
|
||||
|
|
|
@ -26,4 +26,4 @@
|
|||
{"event":"TestStepStarted","location":"formatter-tests/features/some_scenarions_including_failing.feature:14","timestamp":-6795364578871}
|
||||
{"event":"TestStepFinished","location":"formatter-tests/features/some_scenarions_including_failing.feature:14","timestamp":-6795364578871,"status":"skipped"}
|
||||
{"event":"TestCaseFinished","location":"formatter-tests/features/some_scenarions_including_failing.feature:12","timestamp":-6795364578871,"status":"undefined"}
|
||||
{"event":"TestRunFinished","status":"failed","timestamp":-6795364578871,"snippets":"You can implement step definitions for undefined steps with these snippets:\n\nfunc undefined() error {\n\treturn godog.ErrPending\n}\n\nfunc FeatureContext(s *godog.Suite) {\n\ts.Step(`^undefined$`, undefined)\n}\n","memory":""}
|
||||
{"event":"TestRunFinished","status":"failed","timestamp":-6795364578871,"snippets":"You can implement step definitions for undefined steps with these snippets:\n\nfunc undefined() error {\n\treturn godog.ErrPending\n}\n\nfunc InitializeScenario(ctx *godog.ScenarioContext) {\n\tctx.Step(`^undefined$`, undefined)\n}\n","memory":""}
|
||||
|
|
|
@ -32,7 +32,7 @@ func undefined() error {
|
|||
return godog.ErrPending
|
||||
}
|
||||
|
||||
func FeatureContext(s *godog.Suite) {
|
||||
s.Step(`^undefined$`, undefined)
|
||||
func InitializeScenario(ctx *godog.ScenarioContext) {
|
||||
ctx.Step(`^undefined$`, undefined)
|
||||
}
|
||||
</yellow>
|
||||
|
|
|
@ -18,7 +18,7 @@ func undefined() error {
|
|||
return godog.ErrPending
|
||||
}
|
||||
|
||||
func FeatureContext(s *godog.Suite) {
|
||||
s.Step(`^undefined$`, undefined)
|
||||
func InitializeScenario(ctx *godog.ScenarioContext) {
|
||||
ctx.Step(`^undefined$`, undefined)
|
||||
}
|
||||
</yellow>
|
||||
|
|
|
@ -27,8 +27,8 @@ var undefinedSnippetsTpl = template.Must(template.New("snippets").Funcs(snippetH
|
|||
return godog.ErrPending
|
||||
}
|
||||
|
||||
{{end}}func FeatureContext(s *godog.Suite) { {{ range . }}
|
||||
s.Step({{ backticked .Expr }}, {{ .Method }}){{end}}
|
||||
{{end}}func InitializeScenario(ctx *godog.ScenarioContext) { {{ range . }}
|
||||
ctx.Step({{ backticked .Expr }}, {{ .Method }}){{end}}
|
||||
}
|
||||
`))
|
||||
|
||||
|
|
|
@ -145,10 +145,10 @@ func undef() error {
|
|||
return godog.ErrPending
|
||||
}
|
||||
|
||||
func FeatureContext(s *godog.Suite) {
|
||||
s.Step(` + "`^three$`" + `, three)
|
||||
s.Step(` + "`^unavailable \"([^\"]*)\" cost (\\d+)$`" + `, unavailableCost)
|
||||
s.Step(` + "`^undef$`" + `, undef)
|
||||
func InitializeScenario(ctx *godog.ScenarioContext) {
|
||||
ctx.Step(` + "`^three$`" + `, three)
|
||||
ctx.Step(` + "`^unavailable \"([^\"]*)\" cost (\\d+)$`" + `, unavailableCost)
|
||||
ctx.Step(` + "`^undef$`" + `, undef)
|
||||
}
|
||||
|
||||
`
|
||||
|
|
Загрузка…
Создание таблицы
Сослаться в новой задаче