mirror of
https://github.com/httprunner/httprunner.git
synced 2026-05-12 02:21:29 +08:00
90 lines
1.7 KiB
YAML
90 lines
1.7 KiB
YAML
config:
|
|
name: basic test with httpbin
|
|
base_url: https://httpbin.org/
|
|
|
|
teststeps:
|
|
-
|
|
name: headers
|
|
request:
|
|
url: /headers
|
|
method: GET
|
|
validate:
|
|
- eq: ["status_code", 200]
|
|
- eq: [body.headers.Host, "httpbin.org"]
|
|
|
|
-
|
|
name: user-agent
|
|
request:
|
|
url: /user-agent
|
|
method: GET
|
|
validate:
|
|
- eq: ["status_code", 200]
|
|
- startswith: [body."user-agent", "python-requests"]
|
|
|
|
-
|
|
name: get without params
|
|
request:
|
|
url: /get
|
|
method: GET
|
|
validate:
|
|
- eq: ["status_code", 200]
|
|
- eq: [body.args, {}]
|
|
|
|
-
|
|
name: get with params in url
|
|
request:
|
|
url: /get?a=1&b=2
|
|
method: GET
|
|
validate:
|
|
- eq: ["status_code", 200]
|
|
- eq: [body.args, {'a': '1', 'b': '2'}]
|
|
|
|
-
|
|
name: get with params in params field
|
|
request:
|
|
url: /get
|
|
params:
|
|
a: 1
|
|
b: 2
|
|
method: GET
|
|
validate:
|
|
- eq: ["status_code", 200]
|
|
- eq: [body.args, {'a': '1', 'b': '2'}]
|
|
|
|
-
|
|
name: set cookie
|
|
request:
|
|
url: /cookies/set?name=value
|
|
method: GET
|
|
validate:
|
|
- eq: ["status_code", 200]
|
|
- eq: [body.cookies.name, "value"]
|
|
|
|
-
|
|
name: extract cookie
|
|
request:
|
|
url: /cookies
|
|
method: GET
|
|
validate:
|
|
- eq: ["status_code", 200]
|
|
- eq: [body.cookies.name, "value"]
|
|
|
|
-
|
|
name: post data
|
|
request:
|
|
url: /post
|
|
method: POST
|
|
headers:
|
|
Content-Type: application/json
|
|
data: abc
|
|
validate:
|
|
- eq: ["status_code", 200]
|
|
|
|
-
|
|
name: validate body length
|
|
request:
|
|
url: /spec.json
|
|
method: GET
|
|
validate:
|
|
- len_eq: ["body", 9]
|