自动化测试过程中, 经常会遇到功能阻塞, 功能未实现和环境等一系列外部因素问题导致的一些用例执行不了, 如果我们注释掉或删除掉, 后面可能还要进行恢复操作, 这时我们就可以用到跳过用例
Pytest
存在两个跳过测试的方法:skip
和skipif
(注:跳过的用例测试结果标识为s)
skip
skip
方法为无条件跳过测试用例(使用方法:@pytest.mark.skip
)
# <------- test_three.py ------->
#!/usr/bin/python3
# coding=utf-8
# Author: 文
import pytest
class Test_One():
@pytest.mark.skip
def test_01(self):
print("===========> test_01")
def test_02(self):
print("===========> test_02")
if __name__ == "__main__":
pytest.main(["-r