victorolinasc / junit-formatter

A JUnit XML report exporter for Elixir's ExUnit
https://hexdocs.pm/junit_formatter/
Apache License 2.0
111 stars 37 forks source link

failed test not shown as failed in jenkins report #5

Closed schnittchen closed 8 years ago

schnittchen commented 8 years ago

I don't know who's to blame. Here's the generated report:

<?xml version="1.0"?><testsuites><testsuite errors="0" failures="0" name="Elixir.ElixirTestsAndDocsTest" tests="1" time="0"><testcase classname="Elixir.ElixirTestsAndDocsTest" name="test the truth" time="0"/></testsuite><testsuite errors="0" failures="1" name="Elixir.ElixirTestsAndDocs.ModuleWithDoctestsTest" tests="2" time="4"><testcase classname="Elixir.ElixirTestsAndDocs.ModuleWithDoctestsTest" name="test doc at ElixirTestsAndDocs.ModuleWithDoctests.foo/0 (2)" time="0"/><testcase classname="Elixir.ElixirTestsAndDocs.ModuleWithDoctestsTest" name="test doc at ElixirTestsAndDocs.ModuleWithDoctests.bar/0 (1)" time="4"><failed message="error: Doctest failed">    lib/elixir_tests_and_docs/module_with_doctests.ex:14: ElixirTestsAndDocs.ModuleWithDoctests (module)
</error></testcase></testsuite></testsuites>

Jenkins did not pick this up because of the use of the <failed> node, instead of <error>. I verified this by running this right before finishing the build job:

cp _build/test/test-junit-report.xml _build/test/test-junit-report.xml.orig
cat _build/test/test-junit-report.xml.orig | sed 's/failed/error/' > _build/test/test-junit-report.xml

which made the failed test appear as red.

schnittchen commented 8 years ago

I found a schema here https://windyroad.com.au/dl/Open%20Source/JUnit.xsd and it mentiones a <failure> element instead of <failed>. Will try that out and hopefully submit a PR.

schnittchen commented 8 years ago

Oops. Duplicate of #4

victorolinasc commented 8 years ago

Just pushed 0.1.1 with the fix that was in master!