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.

Larry Shatzer
  • 3,579
  • 8
  • 29
  • 36
hansmaad
  • 18,417
  • 9
  • 53
  • 94
  • 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 http://wiki.hudson-ci.org//display/HUDSON/xUnit+Plugin for helpful information – mjn Dec 20 '10 at 12:49
  • The Delphi Code Coverage project uses the HTML publisher plugin, see http://code.google.com/p/delphi-code-coverage/ and http://wiki.hudson-ci.org/display/HUDSON/HTML+Publisher+Plugin so if you can change the DUnit XML to HTML it should work – mjn Dec 20 '10 at 12:50
  • It is a lot better to use it with EMMA as it got native support for it in RC1 version ;) – HX_unbanned Mar 30 '12 at 15:34

2 Answers2

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>
Matthias Alleweldt
  • 2,453
  • 17
  • 16
  • Thank you for your (late) answer. In the meantime I wrote a junitListener. But you are right with this bug. – hansmaad Apr 22 '11 at 12:20
  • 2
    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. – Michael Küller Aug 01 '11 at 12:25
  • 1
    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. – Michael Küller Aug 09 '11 at 15:17
  • 1
    me too! I also would like to know what is necessary to do to use DUnit with hudson/jenkins – neves Feb 03 '12 at 19:44
  • some hidden assumptions. install xUnit testing plug-in for the jenkings. then configue the xUnit to handle in the custom format in the answer. – none Aug 28 '12 at 14:29
  • 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. – none Sep 12 '12 at 12:51
  • THis is strange... The xml above seems to be even malformed... how could this work? – gustavogbc Oct 02 '13 at 21:23
3

What about using XMLTestRunner for NUnit compatible output from DUnit?

Dr.eel
  • 1,837
  • 3
  • 18
  • 28