mirror of
https://github.com/httprunner/httprunner.git
synced 2026-05-15 20:38:44 +08:00
change: use NewStep to construct a new test step
This commit is contained in:
@@ -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)}"}).
|
||||
|
||||
Reference in New Issue
Block a user