TestRunner: add testcase suite writen in YAML

This commit is contained in:
httprunner
2017-06-21 19:17:29 +08:00
parent 3b380bf464
commit 50f5373c41
2 changed files with 15 additions and 2 deletions
+6
View File
@@ -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
@@ -27,3 +30,6 @@
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
View File
@@ -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, {})])