pytest 常用测试报告类型

本文介绍了pytest框架生成的多种测试报告类型,包括allure报告、resultlog文件、JunitXML文件、测试用例URL和HTML报告。详细阐述了生成过程及其用途,如方便持续集成工具读取和展示测试结果。此外,提供了学习软件测试的资源分享。
摘要由CSDN通过智能技术生成

先前博客有介绍pytest测试框架的安装及使用,现在来聊聊pytest可以生成哪些测试报告

1.allure测试报告

关于allure报告参见先前的一篇博文: https://www.cnblogs.com/feng0815/p/13792188.html ,这里不再赘述

2.生成resultlog文件

#!/usr/bin/python
 -*- coding: UTF-8 -*-
"""
@author:chenshifeng
@file:test_report.py
@time:2021/01/27
"""
class TestReport:

    def test_one(self):
        x = "shifeng"
        assert "feng" in x

    def test_two(self):
        x = "hello"
        assert x == "hi"

执行命令:

pytest test_report.py  --resultlog=./resultlog.txt

指定当前路径下生成resultlog.txt文件,打开文件,内容如下:

. reportdemo/test_report.py::TestReport::test_one
F reportdemo/test_report.py::TestReport::test_two
 self = <test_report.TestReport object at 0x7fd9c0a3eac0>
 
     def test_tw
  • 1
    点赞
  • 3
    收藏
    觉得还不错? 一键收藏
  • 1
    评论
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值