Use NUnit Console Runner to run all tests under a folder

hoangbv15 picture hoangbv15 · Dec 21, 2015 · Viewed 11.9k times · Source

I am trying to use NUnit Runners 2.6.4 to run all test assemblies in my test folder. My current command looks like this:

/nologo /noshadow /framework:net-4.0 /xml:.\test\TestResults.xml .\test\*.Test.dll

Unfortunately Nunit just throws a System.ArgumentException: Illegal characters in path.

Is there anyway I can achieve this?

Answer

one_mile_run picture one_mile_run · Aug 3, 2017

You can use following PowerShell command (for NUnit3, for NUnit2 change runner name):

PS> nunit3-console (ls -r *\bin\Debug\*.Tests.dll | % FullName | sort-object -Unique)

Command from previous answer runs each test assembly in separate nunit process synchronously. Presented here command runs all test assemblies in single nunit instance, which allows to leverage engine built-in parallel test run.

Remarks

  1. Remember to tweak directory search pattern. Given example runs only assemblies ending with .Tests.dll and inside \bin\Debug directories.

  2. Be aware of Unique filtering - you may not want to have it.