mirror of
https://github.com/httprunner/httprunner.git
synced 2026-06-13 03:39:44 +08:00
v3 feat: support extract session variables
This commit is contained in:
@@ -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:
|
||||
|
||||
Reference in New Issue
Block a user