测试报告范文_系统测试报告

测试报告范文_系统测试报告前言受益于pytest的集成,HttpRunnerv3.x可以使用pytest所有插件,包括pytest-html和allure-pytest,也可以实现这2种方式的报告内置html报告pyt

大家好,又见面了,我是你们的朋友全栈君。如果您正在找激活码,请点击查看最新教程,关注关注公众号 “全栈程序员社区” 获取激活教程,可能之前旧版本教程已经失效.最新Idea2022.1教程亲测有效,一键激活。

Jetbrains全系列IDE使用 1年只要46元 售后保障 童叟无欺

前言

受益于pytest的集成,HttpRunner v3.x可以使用pytest所有插件,包括pytest-htmlallure-pytest,也可以实现这2种方式的报告
 

内置html报告

pytest-html插件随HttpRunner一期安装。当你运行测试用例想生成html报告时,可以在命令行中添加--html
安装Httprunner时,pytest-html插件也会随之安装,当运行测试用例的时候,想生成html形式的报告,可以在命令行中添加--html + 报告路径

$ hrun /path/to/testcase --html=report.html

举例:在当前目录执行testcases下的所有用例,并在当前目录下的report目录下,生成名为test_report.html的报告

(httprunner_env) ➜  hrun_demo hrun testcases --html=reports/test_report.html                                
2021-02-10 11:24:21.055 | INFO     | httprunner.make:__make:512 - make path: /Users/jkc/hrun/hrun_demo/testcases
2021-02-10 11:24:21.057 | INFO     | httprunner.make:format_pytest_with_black:170 - format pytest cases with black ...
No Path provided. Nothing to do ?
2021-02-10 11:24:21.263 | INFO     | httprunner.cli:main_run:56 - start to run tests with pytest. HttpRunner version: 3.1.4
================================================================================================= test session starts ==================================================================================================
platform darwin -- Python 3.7.6, pytest-5.4.3, py-1.10.0, pluggy-0.13.1
rootdir: /Users/jkc/hrun/hrun_demo
plugins: metadata-1.11.0, html-2.1.1
collected 3 items                                                                                                                                                                                                      

testcases/demo_testcase_ref_test.py .                                                                                                                                                                            [ 33%]
testcases/demo_testcase_request_test.py .                                                                                                                                                                        [ 66%]
testcases/baidu_test.py .                                                                                                                                                                                        [100%]

---------------------------------------------------------------- generated html file: file:///Users/jkc/hrun/hrun_demo/reports/test_report.html ----------------------------------------------------------------
================================================================================================== 3 passed in 4.79s ===================================================================================================

测试报告范文_系统测试报告
打开html报告,查看报告内容
测试报告范文_系统测试报告
如果想创建一个独立的、更加方便共享测试结果的html报告(通俗的说:该目录只有html报告,没有css样式),可以在命令行中添加--self-contained-html

$ hrun /path/to/testcase --html=report.html --self-contained-html

 

allure报告

allure-pytest是HttpRunner的可选依赖项,所以如果想生成allure报告时,需要单独安装:

pip3 install allure-pytest

或者在安装httprunner时选择安装:

pip install "httprunner[allure]"

安装完成后,下面的参数可以使用hrun/pytest的命令:

  • --alluredir=DIR:在指定目录中生成allure报告(可能不存在)
  • --clean-alluredir:清理alluredir文件夹(如果存在)
  • --allure-no-capture:不要将pytest捕获的日志记录/ stdout / stderr附加到报告中
    要使Allure侦听器能够在测试执行期间收集结果,只需添加–alluredir选项,并提供路径即可。
$ hrun /path/to/testcase --alluredir=/tmp/my_allure_results

要在测试完成后查看实际报告,您需要使用Allure命令行实用程序从结果生成报告

# 在线打开报告(此命令将在默认浏览器中显示您生成的报告)
$ allure serve /tmp/my_allure_results
# 生成html报告
allure generate reports/allure -o reports/allure/html

关于allure报告就不做过多的演示了,跟pytest里面用法一样

版权声明:本文内容由互联网用户自发贡献,该文观点仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 举报,一经查实,本站将立刻删除。

发布者:全栈程序员-用户IM,转载请注明出处:https://javaforall.cn/165091.html原文链接:https://javaforall.cn

【正版授权,激活自己账号】: Jetbrains全家桶Ide使用,1年售后保障,每天仅需1毛

【官方授权 正版激活】: 官方授权 正版激活 支持Jetbrains家族下所有IDE 使用个人JB账号...

(0)
blank

相关推荐

发表回复

您的电子邮箱地址不会被公开。

关注全栈程序员社区公众号