mirror of
https://github.com/httprunner/httprunner.git
synced 2026-05-15 12:27:59 +08:00
support variable reference during extraction
This commit is contained in:
@@ -18,6 +18,7 @@ func TestCaseExtractStepSingle(t *testing.T) {
|
||||
"var1": "bar1",
|
||||
"agent": "HttpRunnerPlus",
|
||||
"expectedStatusCode": 200,
|
||||
"jmespathFoo1": "body.args.foo1",
|
||||
}).
|
||||
GET("/get").
|
||||
WithParams(map[string]interface{}{"foo1": "$var1", "foo2": "bar2"}).
|
||||
@@ -25,7 +26,7 @@ func TestCaseExtractStepSingle(t *testing.T) {
|
||||
Extract().
|
||||
WithJmesPath("status_code", "statusCode").
|
||||
WithJmesPath("headers.\"Content-Type\"", "contentType").
|
||||
WithJmesPath("body.args.foo1", "varFoo1").
|
||||
WithJmesPath("$jmespathFoo1", "varFoo1").
|
||||
Validate().
|
||||
AssertEqual("$statusCode", "$expectedStatusCode", "check status code"). // assert with extracted variable from current step
|
||||
AssertEqual("$contentType", "application/json; charset=utf-8", "check header Content-Type"). // assert with extracted variable from current step
|
||||
|
||||
Reference in New Issue
Block a user