Change pytest testsuite name in xml report

2020-07-23 04:14发布

问题:

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"

to

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

回答1:

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


标签: pytest xUnit