多个网站 支付宝接口,做网站最好,中国工商注册网官网网址,越南做企业网站项目自动化测试中#xff0c;如果接口2依赖接口1的响应结果值#xff0c;或者用例2依赖用例1的响应结果值#xff0c;自然需要与接口1或用例1进行关联#xff0c;但是当接口1或用例1执行失败#xff0c;接口2或用例2一定也是失败的#xff0c;所以这时不必要再进行接口2和… 项目自动化测试中如果接口2依赖接口1的响应结果值或者用例2依赖用例1的响应结果值自然需要与接口1或用例1进行关联但是当接口1或用例1执行失败接口2或用例2一定也是失败的所以这时不必要再进行接口2和用例2的执行只需要判断当接口1或用例1执行失败直接标记接口2或用例2失败xfail
1、pytest 里面用 xfail 标记用例为失败的用例pytest.xfail(跳过test_two用例标记为失败)2、标记xfail失败的标识是 x [100%] 1 xfailed in 0.18s import pytest,sys
class Test(object):pytest.fixture()def login(self):login_responesFalseif login_respones:return Trueelse:return Falsedef test_two(self,login):print(login响应结果是%s%login)if loginFalse:pytest.xfail(跳过test_two用例标记为失败)
if __name____main__:pytest.main([-s,test01.py])C:\Program Files\Python35\python.exe C:/Users/wangli/PycharmProjects/Test/test/test01.pytest session starts
platform win32 -- Python 3.5.2, pytest-5.1.2, py-1.8.0, pluggy-0.12.0
rootdir: C:\Users\wangli\PycharmProjects\Test\test
plugins: allure-pytest-2.8.5, html-1.22.0, metadata-1.8.0
collected 1 itemtest01.py login响应结果是False
x 1 xfailed in 0.18s Process finished with exit code 0