I am trying to run NUnit tests from command line and trying to save the results under TestResults folder. I have tried using following commands, but nothing has created the test results under intended folder. Rather the test results got created under the current running folder only!
cmd /k nunit3-console.exe test\bin\Debug\test.dll --where cat=test --labels=All --work=TestResults --out=TestResult.txt --result=TestResult.xml;format=nunit2
cmd /k nunit3-console.exe test\bin\Debug\test.dll --where cat=test --labels=All --work=TestResults --out=TestResults\TestResult.txt --result=TestResults\TestResult.xml;format=nunit2
cmd /k nunit3-console.exe test\bin\Debug\test.dll --where cat=test --labels=All --out=TestResults\TestResult.txt --result=TestResults\TestResult.xml;format=nunit2
Likewise I have also tried changing the default test result filename from TestResult.xml & TestResult.txt to Sample.xml & Sample.txt by updating the --result & --out parameters, but no luck.
The
--outoption has been around for a long time. It causes any output from the test, which would normally go to the console to be written to the file specified.The
--resultoption replaces the old NUnit V2--xmloption, and indicates where an XML output file should be written.I think your problem arises from the fact that your tests produce no output "which would normally go to the console." That's because NUnit 3 sends almost all test output to the XML result file. The only console output that is produced is output written to stderr or created using
TestContext.ErrororTestContext.Progress.It's possible to imagine a change to NUnit whereby use of
--outwould stop the output from being incorporated in the XML file, but that would be breaking for a lot of people.Bottom line: once the output was added to the XML result file, the
--outparameter became somewhat useless. :-(