Search code examples
c#unit-testingnunitnunit-2.6

NUnit output not shown in saved XML report


I am using NUnit 2.6 and have the following test case:

[Test]
public void TestCase()
{
    ....test case code....

// Success
Console.WriteLine("---------------->Test Passed<----------------");
}

After the test case is executed, the results are exported to an XML file (/xml=C:\TestResult.xml). In the resulting XML file, the console text "-->Test Passed<--" is not saved. Is there a way to show the Console.WriteLines in the XML file?

Command line:

"nunit-console-x86.exe" "Test.dll" /xml=C:\TestResult.xml /Domain=None /noshadow

Solution

  • NUnit V2 does not save the output you write in the XML result at all. NUnit 3 adds an output element that contains the text written by each test.