HttpRunner(14):忽略跳过用例--skip
忽略跳过用例:
Httprunner框架中使用和unittest类似的方式进行忽略跳过用例,关键字有3个:
skip:无条件跳过用例
skipIf:条件成立,返回值为True时候成立(非0、非空等为true)
skipUnless:条件不成立,返回值为False时候成立(0、空等为false)
上述关键字只能在test 测试步骤中使用
# skip是用来忽略跳过测试用例 - config: name: 百度主页 base_url: https://www.baidu.com output: - title - test: name: 百度搜索 # 忽略跳过用例只能在测试步骤中使用 skip: 无条件跳过 # skipIf: True # 条件为 True 时跳过 # skipUnless: False # 条件为 False 时跳过 request: url: /s method: GET headers: Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.9 Accept-Encoding: gzip, deflate, br Accept-Language: zh-CN,zh;q=0.9 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/93.0.4577.82 Safari/537.36 params: wd: 猫 extract: - title: <title>(.+?)</title> validate: - eq: [$title,"猫_百度搜索"]