4

Since yesterday I am trying to figure out how to create that XML report that NUnit3 can produce and I just can't find a single example with code.

What should I do in order to make NUnit 3 produce the results file or what and where should I be looking for?

Peter Mortensen
  • 30,738
  • 21
  • 105
  • 131
Darkbound
  • 3,026
  • 7
  • 34
  • 72
  • How are you running your tests, via the NUnit Console runner? If so, it should write a TestResult.xml in the test directory. (Unless you are using a PCL framework build) – Chris Apr 11 '17 at 09:02
  • I am using the Visual Studio Test Explorer – Darkbound Apr 11 '17 at 09:38
  • 1
    This isn't currently possible with the VS adapter, but there's an open feature request: https://github.com/nunit/nunit3-vs-adapter/issues/215 If you use the NUnit Console, you should get the xml result file by default. – Chris Apr 11 '17 at 09:41
  • This would be easily done with the Resharper tool. – kame Apr 11 '17 at 11:32

1 Answers1

3

This can definitely be done using nunit3-console.exe to run your project.

From a CMD/PowerShell console, call \path\to\nunit3-console.exe \path\to\your.dll. A TestResult.xml file is created in \myProjectFolder\bin\Debug by default. You can also add the -out= flag to additionally create a custom log.

For instance, \path\to\nunit3-console.exe \path\to\your.dll -out=\path\to\whereever\testResultFileName.xml. With a simple project, have a [Test] and a Console.WriteLine(). The testname and print statement will show up in your custom file.

Peter Mortensen
  • 30,738
  • 21
  • 105
  • 131
petah
  • 320
  • 3
  • 13