change: use NewStep to construct a new test step

This commit is contained in:
debugtalk
2021-12-07 11:11:03 +08:00
parent 87f22e0a16
commit f7ab39374c
11 changed files with 47 additions and 42 deletions

View File

@@ -19,7 +19,7 @@ func TestCaseCallFunction(t *testing.T) {
},
},
TestSteps: []hrp.IStep{
hrp.Step("get with params").
hrp.NewStep("get with params").
GET("/get").
WithParams(map[string]interface{}{"foo1": "${gen_random_string($n)}", "foo2": "${max($a, $b)}"}).
WithHeaders(map[string]string{"User-Agent": "HttpRunnerPlus"}).
@@ -29,7 +29,7 @@ func TestCaseCallFunction(t *testing.T) {
AssertEqual("status_code", 200, "check status code").
AssertLengthEqual("body.args.foo1", 5, "check args foo1").
AssertEqual("body.args.foo2", "12.3", "check args foo2"), // notice: request params value will be converted to string
hrp.Step("post json data with functions").
hrp.NewStep("post json data with functions").
POST("/post").
WithHeaders(map[string]string{"User-Agent": "HttpRunnerPlus"}).
WithBody(map[string]interface{}{"foo1": "${gen_random_string($n)}", "foo2": "${max($a, $b)}"}).