pytest 常用测试报告类型

先前博客有介绍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</test_report.testreport>

Original: https://blog.csdn.net/zjtdy/article/details/116277034
Author: 测试员~~木子
Title: pytest 常用测试报告类型

原创文章受到原创版权保护。转载请注明出处:https://www.johngo689.com/774911/

转载文章受原作者版权保护。转载请注明原作者出处!

(0)

大家都在看

亲爱的 Coder【最近整理,可免费获取】👉 最新必读书单  | 👏 面试题下载  | 🌎 免费的AI知识星球