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 stdout during the tests.
This works great when running the tests locally using Resharper, since it associates the stdout output to the individual test. However, when running the tests from the NUnit console application, the stdout 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.
Does anyone know of a way to include stdout output inline in the xml results file to make it show up on the NUnit Details screen?
Do you merge?
NUnit generates a 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 to convert you 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 http://www.cruisecontrolnet.org/projects/ccnet/wiki/NUnit_Task and http://confluence.public.thoughtworks.org/display/CCNET/Using+CruiseControl.NET+with+NUnit
来源:https://stackoverflow.com/questions/9025298/putting-console-output-from-nunit-tests-into-the-xml-results