Skip to content

Adding predefined steps in testhttp package

Compare
Choose a tag to compare
@bkielbasa bkielbasa released this 16 Sep 07:42
· 68 commits to master since this release
2d470e3

Here's the full list:

_ = addStep.AddStep(`^I make a (GET|POST|PUT|DELETE|OPTIONS) request to "([^"]*)"$`, testHTTP.makeRequest)
_ = addStep.AddStep(`^the response code equals (\d+)$`, testHTTP.statusCodeEquals)
_ = addStep.AddStep(`^the response contains a valid JSON$`, testHTTP.validJSON)
_ = addStep.AddStep(`^the response is "(.*)"$`, testHTTP.theResponseIs)
_ = addStep.AddStep(`^the response header "(.*)" equals "(.*)"$`, testHTTP.responseHeaderEquals)
_ = addStep.AddStep(`^I have a (GET|POST|PUT|DELETE|OPTIONS) request "(.*)"$`, testHTTP.iHaveARequest)
_ = addStep.AddStep(`^I set request header "(.*)" to "(.*)"$`, testHTTP.iSetRequestSetTo)
_ = addStep.AddStep(`^I set request body to "([^"]*)"$`, testHTTP.iSetRequestBodyTo)
_ = addStep.AddStep(`^the request has body "(.*)"$`, testHTTP.theRequestHasBody)
_ = addStep.AddStep(`^I make the request$`, testHTTP.iMakeRequest)

What's more, I made RequestKey and ResponseKey so defining your custom steps should be easier.