mirror of
https://github.com/httprunner/httprunner.git
synced 2026-05-13 08:59:44 +08:00
add unittest for running single api
This commit is contained in:
8
tests/httpbin/api/get_headers.yml
Normal file
8
tests/httpbin/api/get_headers.yml
Normal file
@@ -0,0 +1,8 @@
|
||||
|
||||
name: headers
|
||||
request:
|
||||
url: http://httpbin.org/headers
|
||||
method: GET
|
||||
validate:
|
||||
- eq: ["status_code", 200]
|
||||
- eq: [content.headers.Host, "httpbin.org"]
|
||||
@@ -279,6 +279,14 @@ class TestHttpRunner(ApiServerUnittest):
|
||||
self.assertFalse(summary["success"])
|
||||
self.assertEqual(summary["stat"]["errors"], 1)
|
||||
|
||||
def test_run_api(self):
|
||||
path = "tests/httpbin/api/get_headers.yml"
|
||||
self.runner.run(path)
|
||||
summary = self.runner.summary
|
||||
self.assertTrue(summary["success"])
|
||||
self.assertEqual(summary["stat"]["testsRun"], 1)
|
||||
self.assertEqual(summary["stat"]["successes"], 1)
|
||||
|
||||
def test_run_testcase_hardcode(self):
|
||||
for testcase_file_path in self.testcase_file_path_list:
|
||||
self.runner.run(testcase_file_path)
|
||||
|
||||
Reference in New Issue
Block a user