nunitcruisecontrol.net

Putting console output from NUnit tests into the XML results


Our build process runs a series of integration tests that hit a web service. Each of these tests generates a unique identifier that is used by the web services to match log messages to service calls. The identifier is written to standard output during the tests.

This works great when running the tests locally using ReSharper, since it associates the standard output output to the individual test. However, when running the tests from the NUnit console application, the standard output output can only be written to the console, or a separate file from the results themselves, not the XML results file that is used by CruiseControl.NET to display the test results.

Is there a way to include standard output output inline in the XML results file to make it show up on the NUnit Details screen?


Solution

  • Do you merge? NUnit generates an XML file which you must merge into the build protocol configure the merge publisher before seeing any output.

    <merge>
      <files>
        <file>Nunit*.xml</file>
      </files>
    </merge>
    

    Addendum

    If you can write it to a separate file, foo.txt, you can always merge into your build protocol. As written above, you can easily merge XML files to your build protocol, so the only question remains is: how can you convert your foo.txt into a foo.xml? In NAnt you could load the text file using

    <loadproperty property="myprop" file="foo.txt"/>
    <xmlpoke file="blank.xml" value="${myprop}" xpath="x/y/z" />
    

    Compare also with NUnit Task and http://confluence.public.thoughtworks.org/display/CCNET/Using+CruiseControl.NET+with+NUnit