All是一款轻量级并且非常灵活的开源测试报告框架。它支持接大多数测试框架,例如TestNG,Pytest,JUint等。它简单易用,易用继承。
首先要安装allure
pip install allure-pytest
allure-pytest是Pytest的一个插件,通过它我们可以生成Allure所需要的用于生成测试报告的数据
在PyCharm中输入命令pip install pytest就可以导入pytest包啦
生成测试报告json
pytest.main(['--alluredir', 'report/result', 'testshop.py'])
运行前的代码
![在这里插入图片描述](https://img-blog.csdnimg.cn/2020091722063637.png?x-oss-process=image/watermark,type_ZmFuZ3poZW5naGVpdGk,shadow_10,text_aHR0cHM6Ly9ibG9nLmNzZG4ubmV0L3dlaXhpbl80MTc4NzE0Nw==,size_16,color_FFFFFF,t_70#pic_center)
运行后的效果