pytest-allure相关
安装
- mac 安装allure
brew install alluer
- 安装插件 allure-pytest
pip3 install allure-pytest
生成报告
- 第一种方式
pytest test_01.py --alluredir=./report --clean-alluredir allure serve /Users/xxx/Documents/dev/report
- 第二种方式
pytest test_01.py --alluredir=./report --clean-alluredir allure generate ./report -o ./report/webreport # 第一个路径是生成的数据路径 第二个路径是生成html报告放到什么路径下面
allure函数使用
-
一级标题
allure.epic
@allure.epic("测试登录模块1") def test001(): with allure.step("打开浏览器"): pass
-
二级标题
allure.feature
@allure.feature("测试登录模块2") def test001(): with allure.step("打开浏览器"): pass
-
三级标题
allure.story
@allure.story("测试登录") def test001(): with allure.step("打开浏览器"): pass
-
用例名称
allure.title
@allure.title("测试用例") # 测试报告讲函数名替换成该用例名称 def test001(): with allure.step("打开浏览器"): pass
-
执行步骤
allure.step
@allure.title("测试用例") # 测试报告讲函数名替换成该用例名称 def test001(): with allure.step("打开浏览器"): pass
【推荐】国内首个AI IDE,深度理解中文开发场景,立即下载体验Trae
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步
· TypeScript + Deepseek 打造卜卦网站:技术与玄学的结合
· 阿里巴巴 QwQ-32B真的超越了 DeepSeek R-1吗?
· 【译】Visual Studio 中新的强大生产力特性
· 【设计模式】告别冗长if-else语句:使用策略模式优化代码结构
· 10年+ .NET Coder 心语 ── 封装的思维:从隐藏、稳定开始理解其本质意义