参考文献:
【pytest】pytest配置文件pytest.ini详解_Bug 挖掘机的博客-CSDN博客
pytest.ini配置 pytest–配置 - 邹邹很busy。 - 博客园
Pytest常用命令
配置项:
markers:它的作用是做注册标记,防止拼写错误
testpaths:用于限定测试用例的搜索范围。只有在pytest未指定文件目录参数或测试用例标识符时,该选项才有作用
norecursedirs = .* venv test_001 *.egg dist build(忽略测试用例搜索目录test_001)
testpaths = test_001(指定测试用例搜索目录,优先于norecursedirs)
python
更改测试搜索的规则
python_classes = Test Test Suite
python_files = test_ test check
python_functions = test_* check_*
禁用用例:设置xfail_strict = true将会使那些被标记为@pytest.mark.xfail但实际通过的测试用例也被报告为失败
xfail_strict = true
addopts:更改默认命令行选项,经常要用到某些参数,又不想重复输入
-vsmqk
–alluredir allure_results allure报告路径