pytest常用运行参数
pytest的参数
- -s 打印信息

- -v显示详细信息

- -k arg 运行名称中包含某个字符串的测试用例
pytest -k normal test_param.py

- -q 简化输入信息

- -x 如如果出现一条测试用例失败,退出测试,调试时可用

- 运行测试目录
pytest -s ./test

- 指定特定的类或方法执行
pytest -s test_param.py::Test_param::test_normal

- --maxfail=num 失败用例数达到指定个数则停止运行
pytest -s test_param.py --maxfail=1

- -m 运行有mark标记的测试用例
标记为high的用例
pytest -m high

-
--collect-only 只收集,不执行


浙公网安备 33010602011771号