nunitnunit-console

Make NUnit have unique results <mytest1>.xml instead of TestResult.xml


I have a situation where more than one NUnit Console Runner might be triggered on the same VM.

How do I uniquely name my TestResult.xml file?

I do not see an option for this in the docs.


So far, my solution has been to dynamically create the my_folder argument in --work=%my_folder%, by generating a unique ID in a batch file. Next, I use that ID in a PowerShell script to parse the correct test.

set id=%random%_%time%
start "Tests" /D "C:\NUnit.ConsoleRunner.3.7.0\tools\" "nunit3-console.exe" ^
    "C:\My_Solution\My_Tests\My_Tests.dll" ^
    "--work=C:\test-results\%id%"
powershell "C:\scripts\parse_test.ps1 %id%"

It would be MUCH easier to just give the TestResult.xml a unique name.

How do I change that name?


Solution

  • The --result option of nunit3-console is used to set the name and path of the result file. If you use a relative path, it is saved relative to the directory you specify with the --work option.

    There is no built-in facility to actually generate a unique name or path, however.