首页 > 其他 > 详细

Pytest 框架入门02--Allure测试报告

时间:2020-10-23 17:48:25      阅读:38      评论:0      收藏:0      [点我收藏+]

Allure框架是一种灵活的轻量级多语言测试报告工具,它不仅能够以简洁的web报告形式显示已测试的内容,而且允许参与开发过程的每个人从测试的日常执行中提取最大限度的有用信息。

在展开Allure详述前,先上一份测试报告,报告主要包含总览、类别、测试套件、图表、时间刻度、功能、包等7大部分,支持自定义诸多信息,包括附件添加、缺陷链接、案例链接、测试步骤、Epic、Feature、Story、Title、案例级别等,相当强大。
技术分享图片

 

 

环境配置:

#安装pytest框架
pip install pytest

#pytest基本报告,用于生成pytest-html报告
pip install pytest-html

pip install allure-pytest

pip install pytest-allure-adaptor


下载Allure命令行工具:

到girhub上下载Allure2 ,地址:https://github.com/allure-framework/allure2/releases
下载完成后,解压放到C盘目录,并配置好环境变量
如:C:\allure-2.13.6\bin 添加到Path中
在DOS中输入:

allure --version 可查看对应的版本号。

设置pytest.ini

 pytest.ini的介绍可参考:https://www.cnblogs.com/yoyoketang/p/9550648.html

[pytest]
addopts = -s  --html=./report/html/Test_Report.html --alluredir ./report/result        
python_files = test_*.py
python_classes = Test*
python_functions = test_*
  • -s   打开详细信息
  • --html   是pytest-html生成目录和文件
  • --alluredir  是xml报告文件存放目录

 

pytest  执行后会有在 ./report/result目录下生成一堆xml的报告文件,当不是我们最终想要的美观报告。

技术分享图片

在终端中输入:
allure generate report/result  -o ./report/allure_html/ --clean

然后再输入,打开美观报告:
allure open allure_html/

 

 

Pytest 框架入门02--Allure测试报告

原文:https://www.cnblogs.com/yu2000/p/13864635.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!