title: How can I write the trace, console and error outputs into my XML report file?
body: <p>I want the <em>Trace</em>, <em>Console</em> and <em>Console Error</em> outputs would be written into the common XML report file (for example into <em>cad.UnitTests.xml</em>). By default this info is not written in XML. </p>
  
  <p><img src="https://i.stack.imgur.com/fBGTG.png" alt="enter image description here"></p>
  
  <p>How can I do it? <code>nunit-console.exe</code> has such parameters:</p>
  
  <pre><code>/output=STR  File to receive test output (Short format: /out=STR)
  /err=STR  File to receive test error output
  </code></pre>
  
  <p>But I need to get it <em>in the same XML file</em>. I need it for both cases: <code>nunit-console.exe</code> and <code>nunit.exe</code>. Also, I looked the settings of GUI NUnit but found nothing.</p>
  
  <p>My BAT file has such content:</p>
  
  <pre><code>:: run_me.bat
  :: © Andrey Bushman, 2015
  ECHO OFF
  
  CD /D %~dp0
  SET file_name=cad.UnitTests
  
  :: Run NUnit tests
  call "%NUNIT%\nunit-console.exe" ^
    /out="%~dp0%file_name%_out.txt" ^
    /err="%~dp0%file_name%_err.txt" ^
    /trace=Verbose ^
    /noshadow ^
    /xml="%~dp0%file_name%.xml" ^
    "%~dp0%file_name%.dll"
  
  :: Get the HTML report of the unit testing
  call "%ReportUnit%\ReportUnit.exe" ^
    "%~dp0%file_name%.xml" ^
    "%~dp0%file_name%.html"
  </code></pre>
  
  <p>But even if I use such command:</p>
  
  <pre><code>call "%NUNIT%\nunit-console.exe" ^
    /out="%~dp0%file_name%_out.txt" ^
    /err="%~dp0%file_name%_err.txt" ^
    /noshadow ^
    /xml="%~dp0%file_name%.xml" ^
    "%~dp0%file_name%.dll"
  </code></pre>
  
  <p>then the <em>Trace</em> output is absent in both files (the <em>"%~dp0%file_name%_out.txt"</em> and <em>"%~dp0%file_name%_err.txt"</em>).</p>
  
  <p>I don't see of <code>nunit-console.exe</code> option for <em>Trace output</em> redirection (something like <code>/traceFile</code>). I see the <code>/trace</code> parameter, but it has other purpose.</p>
  
  <p>It is necessary for me, because I use the result XML for generation of HTML through the <a href="http://relevantcodes.com/reportunit-report-generator/" rel="nofollow noreferrer">ReportUnit.exe</a>. I want to see the detailed info in the HTML.</p>
  
  <p>I can save the Trace output into TXT file in the code of my unit tests:</p>
  
  <pre><code>/* SetUpClass.cs
   * © Andrey Bushman, 2015
   */
  
  namespace Bushman.CAD.UnitTests {
    using System;
    using System.IO;
    using System.Diagnostics;
    using NUnit.Framework;
  
    [SetUpFixture]
    public class SetUpClass {
  
      private TextWriterTraceListener listener = null;
  
      [SetUp]
      public void RunBeforeAnyTests() {
        Stream traceFile = File.Create("trace_out.txt");
        listener = new TextWriterTraceListener(traceFile);
        Trace.Listeners.Add(listener);
      }
  
      [TearDown]
      public void RunAfterAnyTests() {
        listener.Flush();
      }
    }
  }
  </code></pre>
  
  <p>But I still have a hope what I can to get this info in the XML file (which is generated by NUnit) through the "native" way of NUnit.</p>