order控制
首先安装pytest_ordering pip install pytest_ordering
使用装饰器
@pytest.mark.run(order=n) #会按照n的数字大小顺序执行
按模块执行
在pytest.ini里添加markers
再用例上添加装饰器
执行用例时附带上参数 -m marker
跳过用例
用例前添加
@pytest.mark.skip(reason="跳过原因")
按条件跳过
添加装饰器 第一个参数为boolean值
@pytest.mark.skipif(a==1,reason='跳过原因')
生成报告
安装pytest-html
pip install pytest-html
在根目录下创建新文件夹 report
添加 参数 --html ./report/report.html
用例执行后在目标文件夹中生成测试报告