mirror of
https://github.com/httprunner/httprunner.git
synced 2026-09-06 07:57:27 +08:00
TestRunner: add testcase suite writen in YAML
This commit is contained in:
+7
-1
@@ -12,6 +12,9 @@
|
|||||||
status_code: 201
|
status_code: 201
|
||||||
headers:
|
headers:
|
||||||
Content-Type: application/json
|
Content-Type: application/json
|
||||||
|
body:
|
||||||
|
success: true
|
||||||
|
msg: user created successfully.
|
||||||
|
|
||||||
-
|
-
|
||||||
name: create user which existed
|
name: create user which existed
|
||||||
@@ -26,4 +29,7 @@
|
|||||||
response:
|
response:
|
||||||
status_code: 500
|
status_code: 500
|
||||||
headers:
|
headers:
|
||||||
Content-Type: application/json
|
Content-Type: application/json
|
||||||
|
body:
|
||||||
|
success: false
|
||||||
|
msg: user already existed.
|
||||||
+8
-1
@@ -69,9 +69,16 @@ class TestUtils(ApiServerUnittest):
|
|||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
|
||||||
def test_run_testcase_suite_success(self):
|
def test_run_testcase_suite_json_success(self):
|
||||||
testcase_file_path = os.path.join(os.getcwd(), 'test/data/demo.json')
|
testcase_file_path = os.path.join(os.getcwd(), 'test/data/demo.json')
|
||||||
testcases = utils.load_testcases(testcase_file_path)
|
testcases = utils.load_testcases(testcase_file_path)
|
||||||
result = self.test_runner.run_testcase_suite(testcases)
|
result = self.test_runner.run_testcase_suite(testcases)
|
||||||
self.assertEqual(len(result), 2)
|
self.assertEqual(len(result), 2)
|
||||||
self.assertEqual(result, [(True, {}), (True, {})])
|
self.assertEqual(result, [(True, {}), (True, {})])
|
||||||
|
|
||||||
|
def test_run_testcase_suite_yaml_success(self):
|
||||||
|
testcase_file_path = os.path.join(os.getcwd(), 'test/data/demo.yml')
|
||||||
|
testcases = utils.load_testcases(testcase_file_path)
|
||||||
|
result = self.test_runner.run_testcase_suite(testcases)
|
||||||
|
self.assertEqual(len(result), 2)
|
||||||
|
self.assertEqual(result, [(True, {}), (True, {})])
|
||||||
|
|||||||
Reference in New Issue
Block a user