diff --git a/httprunner/runner.py b/httprunner/runner.py index 17c5c04e..86203631 100644 --- a/httprunner/runner.py +++ b/httprunner/runner.py @@ -108,7 +108,10 @@ class Runner(object): setup_actions = testcase_dict.get("setup", []) teardown_actions = testcase_dict.get("teardown", []) - if "skipIf" in testcase_dict: + if "skip" in testcase_dict: + skip_reason = testcase_dict["skip"] + raise SkipTest(skip_reason) + elif "skipIf" in testcase_dict: skip_if_condition = testcase_dict["skipIf"] if self.context.exec_content_functions(skip_if_condition): skip_reason = "{} evaluate to True".format(skip_if_condition) diff --git a/httprunner/task.py b/httprunner/task.py index 03dbd879..3c9efbb4 100644 --- a/httprunner/task.py +++ b/httprunner/task.py @@ -15,11 +15,7 @@ class ApiTestCase(unittest.TestCase): def runTest(self): """ run testcase and check result. """ - if "skip" in self.testcase_dict: - skip_reason = self.testcase_dict["skip"] - self.skipTest(skip_reason) - else: - self.assertTrue(self.test_runner._run_test(self.testcase_dict)) + self.assertTrue(self.test_runner._run_test(self.testcase_dict)) class ApiTestSuite(unittest.TestSuite): """ create test suite with a testset, it may include one or several testcases.