From 8b039d3b1e05570f2d347091c82f46fc16469970 Mon Sep 17 00:00:00 2001 From: debugtalk Date: Wed, 7 Feb 2018 11:08:47 +0800 Subject: [PATCH] fix #96: add skip feature 1, skip=True is equal to times=0; 2, skip priority is higher than times. --- httprunner/__init__.py | 2 +- httprunner/runner.py | 8 +++++++- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/httprunner/__init__.py b/httprunner/__init__.py index 5b0e9362..9d070fbe 100644 --- a/httprunner/__init__.py +++ b/httprunner/__init__.py @@ -1 +1 @@ -__version__ = '0.8.8' \ No newline at end of file +__version__ = '0.8.9' \ No newline at end of file diff --git a/httprunner/runner.py b/httprunner/runner.py index a66ace5c..978c0c60 100644 --- a/httprunner/runner.py +++ b/httprunner/runner.py @@ -71,6 +71,7 @@ class Runner(object): @param (dict) testcase_dict { "name": "testcase description", + "skip": Fasle, "times": 3, "requires": [], # optional, override "function_binds": {}, # optional, override @@ -101,7 +102,12 @@ class Runner(object): except KeyError: raise exception.ParamsError("URL or METHOD missed!") - run_times = int(testcase_dict.get("times", 1)) + skip_current_test = testcase_dict.get("skip", False) + if skip_current_test: + run_times = 0 + else: + run_times = int(testcase_dict.get("times", 1)) + extractors = testcase_dict.get("extract", []) validators = testcase_dict.get("validate", []) setup_actions = testcase_dict.get("setup", [])