概念:是一款基于python语言的单元测试框架

用途:用于发现测试用例、执行测试用例、判断测试结果、生成测试报告的一款框架

测试用例的规则:

测试文件必须与test开头,或_test结尾

类文件必须Test开头

函数必须以test开头

用例的执行步骤

1、当前目录conftest.py

2、pytest.ini

3、用例目录下的conftest.py

4、查看用例里是否有setup teardown,

5、测试用例

用到的插件:

pytest测试框架本身

pytest-ordering测试框架的执行顺序

pytest-rerunfailures失败重试

pytest-html html报告

pytest-xdist 多线程执行
Allure-pytest 定制Allure报告

pytest.ini里包含

addopt执行指令

testpaths测试路径

python_files测试文件

pyhon_classes指定测试类

python_functions指定用例

smoker标签

用到的一些执行命令

-vs 

v输出更多用例详情信息

s输出调试用例信息

-vs --reruns  2  失败重试2次

-x一旦出现错误立即终止执行

--maxfail 失败最多两次终止执行