dunit test result messages in hudson
Asked Answered
B

2

7

i am using Hudson as CI server for Delphi 2010 projects. The XMLTestRunner.pas unit writes DUnit test result to a xml file that is used by the hudson xUnit plugin to report test results. The xUnit plugin shows failures but no messages:

Stacktrace

MESSAGE:

+++++++++++++++++++
STACK TRACE:

In the hudson project configuration at "Publish testing tools result report" i choose "NUnit-Version N/A (default)" as tesing tool, because there is no dunit option in the list and the xml files looks similar to nunit format:

<?xml version="1.0" encoding="ISO-8859-1" standalone="yes" ?>
<test-results total="123" notrun="0" date="20.12.2010" time="09:19:24">
<test-suite name="HelloWorldTestSuite" total="46" notrun="0">
<results>
<test-case name="TestCase.HelloWorldTest" execute="True" success="False" time="0,003" result="Failure">
<failure name="ETestFailure" location=""/>
<message>expected: &lt; hello world! &gt; but was: &lt; hallo welt &gt;</message>
</test-case>
...

In the hudson configuration there is also an "Custom Tool" option, where i have to specify a "Custom stylesheet", but i don't know how to write such a stylesheet (is there any documentation?).

On my C++ projets with boost test, the failures are reported nicely with all messages.

Bartholomew answered 20/12, 2010 at 9:9 Comment(3)
The style sheet usually is a XSL transformation file (however I have not yet tested it with Hudson), you can also try to follow the Free Pascal Unit reference on wiki.hudson-ci.org//display/HUDSON/xUnit+Plugin for helpful informationRecommendation
The Delphi Code Coverage project uses the HTML publisher plugin, see code.google.com/p/delphi-code-coverage and wiki.hudson-ci.org/display/HUDSON/HTML+Publisher+Plugin so if you can change the DUnit XML to HTML it should workRecommendation
It is a lot better to use it with EMMA as it got native support for it in RC1 version ;)Letterpress
R
4

I had to change the XMLListener to get it work with hudson because the XML structure of a failure had to look like this:

<testcase name="GetFreeDirNameTest" classname="Test.exe.MyFiles.TTests" result="failed" time="0.000">
  <failure message="Expected:
        &#34;-1&#34;
        But was:
        &#34;0&#34;" type="failed">GetFreeDirNameTest: Expected:
        &#34;-1&#34;
        But was:
        &#34;0&#34;
  </failure>
</testcase>
Raney answered 15/4, 2011 at 12:49 Comment(7)
Thank you for your (late) answer. In the meantime I wrote a junitListener. But you are right with this bug.Bartholomew
can you explain in more detail what you had to change to make the output look like this. I'm currently running into the exact same problem. I would be very happy, if you could help me with this.Ghostly
I would very much appreciate to get some help on this issue. What needs to be changed to receive the correct output as stated above.Ghostly
me too! I also would like to know what is necessary to do to use DUnit with hudson/jenkinsMb
some hidden assumptions. install xUnit testing plug-in for the jenkings. then configue the xUnit to handle in the custom format in the answer.Certie
after checking things up. it turns out you need the project to include XMLTestRunner.RunRegisteredTests('filename.xml); and then modify that xmlTestRunner.pas (which is located in the delphi folder) to match the strucher in this answer.Certie
THis is strange... The xml above seems to be even malformed... how could this work?Embolic
K
3

What about using XMLTestRunner for NUnit compatible output from DUnit?

Kato answered 21/11, 2013 at 9:19 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.