docs: update changelog and example tests

This commit is contained in:
debugtalk
2020-06-03 18:48:56 +08:00
parent 06912b75b1
commit b11d2b349d
8 changed files with 125 additions and 251 deletions

View File

@@ -1,43 +1,28 @@
# NOTICE: Generated By HttpRunner. DO NOT EDIT!
# FROM: examples/httpbin/validate.yml
from httprunner import HttpRunner, TConfig, TStep
from httprunner import HttpRunner, Config, Step, RunRequest, RunTestCase
class TestCaseValidate(HttpRunner):
config = TConfig(
**{
"name": "basic test with httpbin",
"base_url": "http://httpbin.org/",
"path": "examples/httpbin/validate_test.py",
"variables": {},
}
)
config = Config("basic test with httpbin").base_url("http://httpbin.org/")
teststeps = [
TStep(
**{
"name": "validate response with json path",
"request": {"url": "/get", "params": {"a": 1, "b": 2}, "method": "GET"},
"validate": [
{"eq": ["status_code", 200]},
{"eq": ["body.args.a", 1]},
{"eq": ["body.args.b", 2]},
],
"validate_script": ["assert status_code == 200"],
}
Step(
RunRequest("validate response with json path")
.get("/get")
.with_params(**{"a": 1, "b": 2})
.validate()
.assert_equal("status_code", 200)
.assert_equal("body.args.a", "1")
.assert_equal("body.args.b", "2")
),
TStep(
**{
"name": "validate response with python script",
"request": {"url": "/get", "params": {"a": 1, "b": 2}, "method": "GET"},
"validate": [{"eq": ["status_code", 200]}],
"validate_script": [
"assert status_code == 201",
"a = response_json.get('args').get('a')",
"assert a == '1'",
],
}
Step(
RunRequest("validate response with python script")
.get("/get")
.with_params(**{"a": 1, "b": 2})
.validate()
.assert_equal("status_code", 200)
),
]