pytest文档75

您所在的位置:网站首页 junit报告html pytest文档75

pytest文档75

2024-06-03 18:18| 来源: 网络整理| 查看: 265

前言

pytest 生成junit-xml 测试报告,那么生成的xml报告有什么用呢?可以集合一些持续集成工具(如jenkins...等)方便查看报告。

junit-xml 测试报告

命令行参数有2个跟 junit-xml 报告相关的参数

--junit-xml=path create junit-xml style report file at given path. --junit-prefix=str prepend prefix to classnames in junit-xml output

--junit-xml 指定报告保存地址,使用示例

> pytest demo --junit-xml=./report.xml

运行后会在当前目录生成一个report.xml格式报告

--junit-prefix 设置xml报告的class属性,使用示例

> pytest demo --junit-xml=./report.xml --junit-prefix=xxx

pytest.ini配置

pytest.ini配置有5个参数可以配置

junit_suite_name (string): Test suite name for JUnit report junit_logging (string): Write captured log messages to JUnit report: one of no|log|system-out|system-err|out-err|all junit_log_passing_tests (bool): Capture log information for passing tests to JUnit report: junit_duration_report (string): Duration time to report: one of total|call junit_family (string): Emit XML for schema: one of legacy|xunit1|xunit2

junit_suite_name 参数可以修改JUnit报告的名称,使用示例,在pytest.ini配置文件添加

[pytest] junit_suite_name=yoyo

运行后会在xml报告中修改testsuite中的name属性

在命令行中也可以通过传参-o junit_suite_name也可以改变testsuite中的name属性

> pytest demo --junit-xml=./report.xml -o junit_suite_name


【本文地址】


今日新闻


推荐新闻


CopyRight 2018-2019 办公设备维修网 版权所有 豫ICP备15022753号-3