pytest
pytest的运行方式
. 点号,表示用例通过 F 表示失败 Failure E 表示用例中存在异常 Error
pytest命名规则命名规则
类名必须是Test开头测试用例(方法) test开头 模块:test_开头或者是_test结尾 
参数
–html =./report.html生成pytest自带的测试报告(pip install pytst-html)  -x退到错误测试用例,直接停止  -S:打印输出内容print() 
规则
setup:有几个测试用例,执行几次,在测试用例执行之前调用 teardown:有几个测试用例,执行几次,在测试用例执行之后调用  setup_class :有几个测试用例,执行一次。在测试用例执行之前调用 teardown_class:有几个测试用例,执行—次,在测试用例执行之后调用 
调用
pytest.main([]) 
导入生成测试报告
导入HtmlTestRunnre.py
模块名:
模块名::类名::方法名 
数据分离
data包用于存放数据xml/csv/excel readdata包,用于读取data包中的数据 testdemo包存放测试用例的(导入读取数据的模块,开发的代码模块,unittest)通过断言验证预期结果和实际结果 
allure环境配置下载:
pip install allure-pytest
|