Unittest xml file not valid

20 views
Skip to first unread message

Fabian Cenedese

unread,
Dec 7, 2022, 12:50:38 AM12/7/22
to jenkins...@googlegroups.com
Hello

I'm using pytest for testing and have it generate a unittest
xml file that can be read by Jenkins. This has worked fine
for other jobs but now I have a new job where Jenkins doesn't
like the file:

01:12:52 org.jenkinsci.plugins.xunit.service.TransformerException: The result file 'C:\Jenkins\workspace\applicationtest\applicationtest\unittest.xml' for the metric 'CppUnit' is not valid. The result file has been skipped.

However the file exists and XmlLint doesn't see a problem with it.
No un-escaped special chars or < > etc. There's a <testsuites>
tag and it just looks like other files from other jobs that work.

<?xml version="1.0" encoding="utf-8"?><testsuites><testsuite name="pytest" errors="0" failures="31" skipped="0" tests="37" time="342.813" timestamp="2022-12-07T01:07:09.246626" hostname="TestHost7"><testcase classname="tests.test_explorer.TestClass" name="test_Exp_Invisible" time="85.074"><failure message="AssertionError: assert False&#10; + where False = &lt;
...
framework\apptester.py:199: AssertionError</failure></testcase><testcase classname="tests.test_varlog.TestClass" name="test_Quit" time="0.012" /></testsuite></testsuites>

Is there a way to see what exactly it is that Jenkins doesn't like
about this file?

Thanks

bye Fabi

Ullrich Hafner

unread,
Dec 7, 2022, 7:17:21 AM12/7/22
to Jenkins Users
The best way would be to clone the xunit plugin and feed your file as a new test case. Then you can directly see what is broken.
> --
> You received this message because you are subscribed to the Google Groups "Jenkins Users" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to jenkinsci-use...@googlegroups.com.
> To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-users/770c9b9f82cede0ddb2e83a818ba0f09%40indel.ch.

Fabian Cenedese

unread,
Dec 7, 2022, 10:14:16 AM12/7/22
to Jenkins Users
At 13:16 07.12.2022, Ullrich Hafner wrote:

>The best way would be to clone the xunit plugin and feed your file as a new test case. Then you can directly see what is broken.

I found that pytest generates a JUnit format file. With JUnit as parser
insteap of CppUnit it works. So it was a user error, sorry for that.

Thanks for helping.

bye Fabi

Ullrich Hafner

unread,
Dec 7, 2022, 11:49:21 AM12/7/22
to Jenkins Users
Ok, good to see. Then you might not need the xunit plugin at all, since the JUnit plugin supports this XML format out-of-the-box.
> --
> You received this message because you are subscribed to the Google Groups "Jenkins Users" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to jenkinsci-use...@googlegroups.com.
> To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-users/5a7afe81055c313ce9cf7aeb457128cb%40indel.ch.

christop...@googlemail.com

unread,
Dec 9, 2022, 8:04:17 AM12/9/22
to Jenkins Users
Hi Ullrich,

could you please help me with a question some posts older:
xunit seems to support a number of testDataPublishers where attachments() is one of them. Do you know any documentation how this works? Is it the same way it works for junit? I don't think so, otherwhise it should work for me...

Thanks in advance!
BR,
Christoph
Reply all
Reply to author
Forward
0 new messages