| 4 | |
| 5 | |
| 6 | class TestCaseValidate(HttpRunner): |
| 7 | |
| 8 | config = Config("basic test with httpbin").base_url("${get_httpbin_server()}") |
| 9 | |
| 10 | teststeps = [ |
| 11 | Step( |
| 12 | RunRequest("validate response with json path") |
| 13 | .get("/get") |
| 14 | .with_params(**{"a": 1, "b": 2}) |
| 15 | .validate() |
| 16 | .assert_equal("status_code", 200) |
| 17 | .assert_equal("body.args.a", "1") |
| 18 | .assert_equal("body.args.b", "2") |
| 19 | ), |
| 20 | Step( |
| 21 | RunRequest("validate response with python script") |
| 22 | .get("/get") |
| 23 | .with_params(**{"a": 1, "b": 2}) |
| 24 | .validate() |
| 25 | .assert_equal("status_code", 200) |
| 26 | ), |
| 27 | ] |
| 28 | |
| 29 | |
| 30 | if __name__ == "__main__": |
no test coverage detected