joshdk / go-junit

🐜 Go library for ingesting JUnit XML reports
MIT License
59 stars 21 forks source link

Expose skipped message #40

Closed paddatrapper closed 3 years ago

paddatrapper commented 3 years ago

The Junit schema allows results to present a message as a child of a skipped element. It would be useful to be able to access that through go-junit. An example is below:

<testsuites>
    <testsuite tests="1" failures="0" time="" name="demo">
        <testcase classname="demo.case" name="test">
            <skipped message="reason"></skipped>
        </testcase>
    </testsuite>
</testsuites>

The source for this is line 335 of http://svn.apache.org/repos/asf/ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/optional/junit/XMLJUnitResultFormatter.java

joshdk commented 3 years ago

👋🏻 Hello @paddatrapper!

So sorry I didn't see this issue, great find by the way. I went and created #41 to implement this, so please take a look and let me know if it works for your use-case!

Is there an example of such a test XML file available on the internet that I can link to? I always like to link to its origin if possible.

Also, do you have any more information on what exact piece of tooling you were using to generate such an XML? I included your test case in my PR as ant.xml, but this isn't a very descriptive name 😁

Thank you again!

paddatrapper commented 3 years ago

I'll give it a test, thanks! A brief glance at the PR now looks like it would work for us.

Any of the test-result from https://github.com/flanksource/karina/actions/workflows/kind.yml should include the skipped message. For example https://github.com/flanksource/karina/suites/2111872017/artifacts/42987817

It is a tool called Karina, though the actual XML generation happens commons (struct). go-junit is used as the library to process test results after CI/unit tests are run.

joshdk commented 3 years ago

@paddatrapper #41 has been merged, so please update on your end. Thank you again for the issue! 😁

I also appreciate the details you gave above. I went and grabbed one of the xml files from go-junit-report that contains a skipped message, and used that as a test case.

Cheers!