godog/features/snippets.feature
gedi 970eddc16a refactor suite runner to support concurrent model
* ef86715 add a concurrency flag
* 8674a58 run suite concurrently, closes #3
2015-07-03 15:54:26 +03:00

64 строки
2,1 КиБ
Gherkin

Feature: undefined step snippets
In order to implement step definitions faster
As a test suite user
I need to be able to get undefined step snippets
Scenario: should generate snippets
Given a feature "undefined.feature" file:
"""
Feature: undefined steps
Scenario: get version number from api
When I send "GET" request to "/version"
Then the response code should be 200
"""
When I run feature suite
Then the following steps should be undefined:
"""
I send "GET" request to "/version"
the response code should be 200
"""
And the undefined step snippets should be:
"""
func iSendrequestTo(arg1, arg2 string) error {
return godog.ErrPending
}
func theResponseCodeShouldBe(arg1 int) error {
return godog.ErrPending
}
func featureContext(s *godog.Suite) {
s.Step(`^I send "([^"]*)" request to "([^"]*)"$`, iSendrequestTo)
s.Step(`^the response code should be (\d+)$`, theResponseCodeShouldBe)
}
"""
Scenario: should generate snippets with more arguments
Given a feature "undefined.feature" file:
"""
Feature: undefined steps
Scenario: get version number from api
When I send "GET" request to "/version" with:
| col1 | val1 |
| col2 | val2 |
Then the response code should be 200 and header "X-Powered-By" should be "godog"
"""
When I run feature suite
Then the undefined step snippets should be:
"""
func iSendrequestTowith(arg1, arg2 string, arg3 *gherkin.DataTable) error {
return godog.ErrPending
}
func theResponseCodeShouldBeAndHeadershouldBe(arg1 int, arg2, arg3 string) error {
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)
}
"""