[pytest]
addopts = -vs
测试用例文件夹,可自己配置
testpaths = ./testcase
配置测试搜索的模块文件名称
python_files = test_*.py
配置测试搜索的测试类名
python_classes = Test*
配置测试搜索的测试函数名
python_functions = testimport os
我们测试完最终要形成测试报告也可以在pytest.ini文件中配置。
addopts = -vs --alluredir ./test_report/report
在最后执行过用例的过程中,如果是命令行模式,我们直接输入pytest,主函数模式直接输入,pytest.main(),pytest会自动去调用pytest.ini文件中的内容,是不是特别强大。
pytest
pytest-html
pytest-xdist
pytest-rerunfailures
allure-pytest
终端执行:pip install -r requirements.txt 一键安装对应的库即可。
因篇幅问题不能全部显示,请点此查看更多更全内容