support variable reference during extraction

This commit is contained in:
buyuxiang
2022-06-24 17:46:22 +08:00
parent 51bd652c8c
commit f986a2298a
5 changed files with 27 additions and 25 deletions

View File

@@ -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