TestRunner: add testcase suite writen in YAML

This commit is contained in:
debugtalk
2017-06-21 19:17:29 +08:00
parent fc7ded4046
commit b89c941236
2 changed files with 15 additions and 2 deletions

View File

@@ -12,6 +12,9 @@
status_code: 201
headers:
Content-Type: application/json
body:
success: true
msg: user created successfully.
-
name: create user which existed
@@ -26,4 +29,7 @@
response:
status_code: 500
headers:
Content-Type: application/json
Content-Type: application/json
body:
success: false
msg: user already existed.

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')
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, {})])
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, {})])