From b89c941236934be5870994caaffe8e9fd7c23b97 Mon Sep 17 00:00:00 2001 From: debugtalk Date: Wed, 21 Jun 2017 19:17:29 +0800 Subject: [PATCH] TestRunner: add testcase suite writen in YAML --- test/data/demo.yml | 8 +++++++- test/test_runner.py | 9 ++++++++- 2 files changed, 15 insertions(+), 2 deletions(-) diff --git a/test/data/demo.yml b/test/data/demo.yml index 242663a4..18cc08eb 100644 --- a/test/data/demo.yml +++ b/test/data/demo.yml @@ -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 \ No newline at end of file + Content-Type: application/json + body: + success: false + msg: user already existed. \ No newline at end of file diff --git a/test/test_runner.py b/test/test_runner.py index 54437087..6e1f0e7c 100644 --- a/test/test_runner.py +++ b/test/test_runner.py @@ -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, {})])