v3 feat: support extract session variables

This commit is contained in:
debugtalk
2020-04-20 13:26:40 +08:00
parent 39b8f74b27
commit bd7b84d42c
4 changed files with 41 additions and 17 deletions

View File

@@ -10,7 +10,7 @@ teststeps:
name: get with params
variables:
foo1: bar1
foo2: bar2
foo2: session_bar2
request:
method: GET
url: /get
@@ -19,24 +19,27 @@ teststeps:
foo2: $foo2
headers:
User-Agent: HttpRunner/3.0
extract:
session_foo2: "body.args.foo2"
validate:
- eq: ["status_code", 200]
- eq: ["body.args.foo1", "session_bar1"]
- eq: ["body.args.foo2", "bar2"]
- eq: ["body.args.foo2", "session_bar2"]
-
name: post raw text
variables:
foo1: "hello world"
foo3: "$session_foo2"
request:
method: POST
url: /post
headers:
User-Agent: HttpRunner/3.0
Content-Type: "text/plain"
data: "This is expected to be sent back as part of response body: $foo1."
data: "This is expected to be sent back as part of response body: $foo1-$foo3."
validate:
- eq: ["status_code", 200]
- eq: ["body.data", "This is expected to be sent back as part of response body: session_bar1."]
- eq: ["body.data", "This is expected to be sent back as part of response body: session_bar1-session_bar2."]
-
name: post form data
variables: