mirror of
https://github.com/httprunner/httprunner.git
synced 2026-07-09 14:32:31 +08:00
change: use NewStep to construct a new test step
This commit is contained in:
@@ -14,7 +14,7 @@ func TestCaseBasicRequest(t *testing.T) {
|
||||
Verify: false,
|
||||
},
|
||||
TestSteps: []hrp.IStep{
|
||||
hrp.Step("get with params").
|
||||
hrp.NewStep("get with params").
|
||||
GET("/get").
|
||||
WithParams(map[string]interface{}{"foo1": "bar1", "foo2": "bar2"}).
|
||||
WithHeaders(map[string]string{
|
||||
@@ -26,7 +26,7 @@ func TestCaseBasicRequest(t *testing.T) {
|
||||
AssertEqual("headers.\"Content-Type\"", "application/json; charset=utf-8", "check header Content-Type").
|
||||
AssertEqual("body.args.foo1", "bar1", "check args foo1").
|
||||
AssertEqual("body.args.foo2", "bar2", "check args foo2"),
|
||||
hrp.Step("post raw text").
|
||||
hrp.NewStep("post raw text").
|
||||
POST("/post").
|
||||
WithHeaders(map[string]string{
|
||||
"User-Agent": "HttpRunnerPlus",
|
||||
@@ -36,7 +36,7 @@ func TestCaseBasicRequest(t *testing.T) {
|
||||
Validate().
|
||||
AssertEqual("status_code", 200, "check status code").
|
||||
AssertEqual("body.data", "This is expected to be sent back as part of response body.", "check data"),
|
||||
hrp.Step("post form data").
|
||||
hrp.NewStep("post form data").
|
||||
POST("/post").
|
||||
WithHeaders(map[string]string{
|
||||
"User-Agent": "HttpRunnerPlus",
|
||||
@@ -47,7 +47,7 @@ func TestCaseBasicRequest(t *testing.T) {
|
||||
AssertEqual("status_code", 200, "check status code").
|
||||
AssertEqual("body.form.foo1", "bar1", "check form foo1").
|
||||
AssertEqual("body.form.foo2", "bar2", "check form foo2"),
|
||||
hrp.Step("post json data").
|
||||
hrp.NewStep("post json data").
|
||||
POST("/post").
|
||||
WithHeaders(map[string]string{
|
||||
"User-Agent": "HttpRunnerPlus",
|
||||
@@ -57,7 +57,7 @@ func TestCaseBasicRequest(t *testing.T) {
|
||||
AssertEqual("status_code", 200, "check status code").
|
||||
AssertEqual("body.json.foo1", "bar1", "check json foo1").
|
||||
AssertEqual("body.json.foo2", "bar2", "check json foo2"),
|
||||
hrp.Step("put request").
|
||||
hrp.NewStep("put request").
|
||||
PUT("/put").
|
||||
WithHeaders(map[string]string{
|
||||
"User-Agent": "HttpRunnerPlus",
|
||||
|
||||
Reference in New Issue
Block a user