95

We don’t allow questions seeking recommendations for software libraries, tutorials, tools, books, or other off-site resources. You can edit the question so it can be answered with facts and citations.

Closed10 years ago.

The community reviewed whether to reopen this question3 months ago and left it closed:

Original close reason(s) were not resolved

Where can I find the specification of JUnit's XML output.My goal is to write a UnitTest++ XML reporter which produced JUnit like output.

See: "Unable to get hudson to parse JUnit test output XML" and "Hudson, C++ and UnitTest++"

askedJan 14, 2009 at 10:33
Gilad Naor's user avatar
3
  • Could you provide some more information, which output do you mean? Probably an example or instruction how to get such an ouput? Thanks!CommentedJan 16, 2009 at 6:59
  • Is it for JUnit 4.x? Which TestRunner do you use?CommentedMay 6, 2009 at 7:55
  • if you had the time to write an XML reporter for UnitTest++, I would be interested if you can share it.CommentedNov 8, 2010 at 16:57

5 Answers5

57

You can find an XSD based on the code in Apache Ant 1.8.2 athttps://github.com/windyroad/JUnit-Schema

answeredFeb 7, 2011 at 20:17
Tom Howard's user avatar
Sign up to request clarification or add additional context in comments.

4 Comments

See my commentary atwindyroad.zendesk.com/entries/… for pieces missing from this XSD.
bringing the comment on-site,Reinderien found out that these are seems to be missing:/testsuites/testsuite/@skipped,/testsuites/testsuite/testcase/skipped,/testsuites/testsuite/error,/testsuites/testsuite/failure,/testsuites/testsuite/system-err, after readthrough ofXMLJUnitResultFormatter.java,XMLResultAggregator.java,XMLConstants.java atsvn.apache.org/repos/asf/ant/core/trunk/src/main/org/apache/…
@naxa, I believe those nodes were added after Apache Ant 1.8.2. I recall being very thorough at the time (back at the begging of 2011). I've just moved the XSD to github and switched the license to the Apache License version 2.0. Feel free to fork and update.
This was a huge help getting my custom C# testing application to output results in a way that Azure Devops pipelines could understand.
13

The xml output is not generated by JUnit (at least, not the junit.jar), but by the junit ant task.
The relevant class isorg.apache.tools.ant.taskdefs.optional.junit.XMLJUnitResultFormatter.

answeredAug 31, 2009 at 10:08
Laurent Doré's user avatar

3 Comments

This is great. I'd love to see real documentation or a real spec, but otherwise there's nothing more authoritative than the source.
Interpretation of that source also requires readingsvn.apache.org/repos/asf/ant/core/trunk/src/main/org/apache/… .
Also readsvn.apache.org/repos/asf/ant/core/trunk/src/main/org/apache/… since it's the source of the package and ID attributes.
9
answeredMay 5, 2009 at 14:44
HD.'s user avatar

2 Comments

yes, I've landed on that page too, but it's not complete. in extending RUnit (unit testing for R) so that it produces output compatible with Hudson, I ended up producing one "testsuites", there a list of "testsuite" and in these all "testcase". I still don't know how to mark deactivated tests.
7

As others have mentioned the xml is handled by ANT not jUnit

Here's the best spec I've seen. Fromthis post

answeredMay 1, 2010 at 4:16
case nelson's user avatar

1 Comment

-6

I can only give you an general information.

In thesourcecode of JUnit, you will find your information.If you provide some more information, I can help you further. My personal hint for finding your specification would bejunit.framework.TestResult.

Good luck!

answeredJan 19, 2009 at 11:15
guerda's user avatar

1 Comment

JUnit knows nothing at all about this format. It's generated by ant. It's a bit of a funny business.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.