一、pytest 安装
官方文档:https://docs.pytest.org/en/latest/
1. pytest安装
pip install pytest -U -i https://pypi.tuna.tsinghua.edu.cn/simple
# 常用插件
1. html 报告插件
pip install pytest-html
使用方法:pytest --html=report.html
2. 分布式运行
pip install pytest-xdist
使用方法:
pytest -n 2 (2代表2个CPU)
pytest -n auto
3.失败重跑插件
pip install pytest-rerunfailures
使用方法:
1. 指定单个用例:@pytest.mark.flaky(reruns = 5 ,reruns-delay = 1 )
2. 命令行运行:pytest test_demo.py --reruns 5 --reruns-delay 1 -vs
4.allure报告
pip install allure-pytes
注意:allure win上需要单独下载安装
5.执行顺序插件
pip install pytest-ordering
使用方法 : @pytest.mark.run(order=2)
6.多重校验
pip install pytest-