#96: skip unless condition

This commit is contained in:
httprunner
2018-02-08 22:36:30 +08:00
parent f17297b097
commit b247cd49bc
3 changed files with 48 additions and 10 deletions

View File

@@ -89,7 +89,7 @@
- {"check": "content.success", "comparator": "eq", "expect": false}
- test:
name: create user which existed (skip with condition)
name: create user which existed (skip if condition)
skipIf: ${skip_test_in_production_env()}
times: 2
request:
@@ -108,3 +108,24 @@
- "eq": ["content.success", false]
- {"check": "status_code", "comparator": "eq", "expect": 500}
- {"check": "content.success", "comparator": "eq", "expect": false}
- test:
name: create user which existed (skip unless condition)
skipUnless: ${skip_test_in_production_env()}
times: 2
request:
url: http://127.0.0.1:5000/api/users/1000
method: POST
headers:
Content-Type: application/json
device_sn: 'HZfFBh6tU59EdXJ'
token: $token
json:
name: "user1"
password: "123456"
validate:
- "eq": ["status_code", 500]
- sum_status_code: ["status_code", 5]
- "eq": ["content.success", false]
- {"check": "status_code", "comparator": "eq", "expect": 500}
- {"check": "content.success", "comparator": "eq", "expect": false}

View File

@@ -26,7 +26,7 @@ class TestCli(ApiServerUnittest):
def test_run_times(self):
result = HTMLTestRunner(**self.kwargs).run(self.task_suite)
self.assertEqual(result.testsRun, 8)
self.assertEqual(result.testsRun, 10)
shutil.rmtree(self.report_save_dir)
def test_skip(self):