Files
httprunner/examples/postman_echo/request_methods/request_with_variables.yml
debugtalk 915ac691ff change: override variables
(1) testcase: session variables > step variables > config variables
(2) testsuite: testcase variables > config variables
(3) testsuite testcase variables > testcase config variables
2020-06-08 16:11:06 +08:00

58 lines
1.5 KiB
YAML

config:
name: "request methods testcase with variables"
variables: ${get_testcase_config_variables()}
base_url: "https://postman-echo.com"
verify: False
teststeps:
-
name: get with params
variables:
foo1: bar11
foo2: bar21
request:
method: GET
url: /get
params:
foo1: $foo1
foo2: $foo2
headers:
User-Agent: HttpRunner/3.0
extract:
foo3: "body.args.foo2"
validate:
- eq: ["status_code", 200]
- eq: ["body.args.foo1", "bar11"]
- eq: ["body.args.foo2", "bar21"]
-
name: post raw text
variables:
foo1: "bar12"
foo3: "bar32"
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-$foo2-$foo3."
validate:
- eq: ["status_code", 200]
- eq: ["body.data", "This is expected to be sent back as part of response body: bar12-testcase_config_bar2-bar21."]
-
name: post form data
variables:
foo2: bar23
request:
method: POST
url: /post
headers:
User-Agent: HttpRunner/3.0
Content-Type: "application/x-www-form-urlencoded"
data: "foo1=$foo1&foo2=$foo2&foo3=$foo3"
validate:
- eq: ["status_code", 200]
- eq: ["body.form.foo1", "testcase_config_bar1"]
- eq: ["body.form.foo2", "bar23"]
- eq: ["body.form.foo3", "bar21"]