搜索
您的当前位置:首页pytest框架中pytest.ini配置文件

pytest框架中pytest.ini配置文件

来源:乌哈旅游

一、什么是pytest.ini

二、如何使用pytest.ini

[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 
pytest-html
pytest-xdist
pytest-rerunfailures
allure-pytest

终端执行:pip install -r requirements.txt 一键安装对应的库即可。

因篇幅问题不能全部显示,请点此查看更多更全内容

Top