:命名规则
显示没有测试用例
我们改了一个名字就可以了
除了这种还有一种也可以:
如下:指定一下就行
安装pytest-html:
命令:pip install pytest-html
pytest生成自带的html测试报告
(需要先下载,我下载的方法在上边^)
代码如下:
pytest.main(["--html=./report.html","模块.py"])
若只向跑一个
pytest调用语句
语句: pytst.main(['-x','--html=./report.html','t12est000.py'])
-x出现一条测试用例失败就退出测试
-s:显示print内容
使用-x:的方式
使用@pytest.mark.skip()跳过该用例(函数)
文件读取:xml
csv
allure
配置成功
安装allure:
命令:pip insert allure-pytest
allure常用的几个特性
@allure.feature # 用于描述被测试产品需求
@allure.story # 用于描述feature的用户场景,即测试需求
with allure.step(): # 用于描述测试步骤,将会输出到报告中
allure.attach # 用于向测试报告中输入一些附加的信息,通常是一些测试数据,截图等
案例:
@allure.feature # 用于描述被测试产品需求
@allure.story # 用于描述feature的用户场景,即测试需求
with allure.step(): # 用于描述测试步骤,将会输出到报告中
allure.attach # 用于向测试报告中输入一些附加的信息,通常是一些测试数据,截图等