在 xml 报告中更改 pytest 测试套件名称 [英] Change pytest testsuite name in xml report

查看:54
本文介绍了在 xml 报告中更改 pytest 测试套件名称的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

因为我们使用不同的界面开始了相同的测试,然后将所有报告发送给 jenkins.很难识别我们有错误的界面.在我们使用nose之前,它有参数--xunit-testsuite-name",有pytest模拟吗?我想在报告中更改测试套件的名称

Because we started same tests with different interface, then take all reports and send them to jenkins. It's difficult to recognise with what interface we have errors. Before we use nose, it has parameter "--xunit-testsuite-name", has pytest analog? I want to change name of test suite in reports

testsuite errors="0" failures="0" name="pytest" skips="0" tests="12" time="103.702"

testsuite errors="0" failures="0" name="pytest" skips="0" tests="12" time="103.702"

testsuite errors="0" failures="0" name="inteface1" skips="0" tests="12" time="103.702"

testsuite errors="0" failures="0" name="inteface1" skips="0" tests="12" time="103.702"

推荐答案

从 pytest 3.1 开始,您可以将 junit_suite_name 属性添加到您的 Pytest 配置文件中:

You can add a junit_suite_name attribute to your Pytest config file since pytest 3.1:

[pytest]
junit_suite_name = my_suite

这也可以在命令行中设置:

This can also be set in the command line:

pytest ... -o junit_suite_name=my_suite

这篇关于在 xml 报告中更改 pytest 测试套件名称的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆