Tests are not running in parallel using NUnit


I am having NUnit/.NET solution with following structure:

solutionDir/Integration/Integration.Suite1.Tests/all files including .csproj

solutionDir/Integration/Integration.Suite2.Tests/all files including .csproj

solutionDir/Integration/Integration.Suite3.Tests/all files including .csproj

solutionDir/Tests/Unit.Suite1.Tests/all files including .csproj

solutionDir/Tests/Unit.Suite2.Tests/all files including .csproj

solutionDir/Tests/Unit.Suite3.Tests/all files including .csproj

solutionDir/Tests/Unit.Suite4.Tests/all files including .csproj

solutionDir/Tests/Unit.Suite5.Tests/all files including .csproj


They all can be run in parallel and we are supporting it using appropriate attributes (including AssemblyInfo.cs changes) - without them it takes ~15 minutes, even locally


Running all of them are taking:

~2 minutes using Visual Studio NUnit runner

~1:30 using nunit3-console on local machine

~2 minutes using TeamCity build Command Line step (%toolsPath%\NUnit.ConsoleRunner\tools\nunit3-console.exe path to csproj file 1 ... path to csproj file last /config:Release)

~10-15 minutes using NUnit runner


How can we configure NUnit runner to be faster. I observed it builds multiple .nunit files in artifacts and process them in series instead in parallel. 

Using nunit_use_project_file doesn't fix anything.

My step is configured as default, with Run test from set as **\bin\%system.Configuration%\*.Tests.dll, where %system.Configuration% is Release.


What is very important, above NUit run I need to have code coverage done as well.

Official comment

Hi Pawel,
Could you temporarily switch off code coverage, run a build and attach a build log file?

Hi Pawel,

When you specify assemblies for NUnit runner, TeamCity finds all the relevant files, and then creates a .nunit project file for each working directory and then it runs a new instance of nunit for each .nunit project file it has created. It does so to support backward compatibility with NUnit 2.

You could avoid it by adding the configuration parameter `nunit_use_project_file=false` to your build configuration. In that case TeamCity will not create the config file at all will pass required parameters via command line arguments, which will run your tests in parallel.

Please note that it might cause an error due to the command line being too long. IIRC its length is limited to 4KB.




Have you read whole of my post?

In bold:

Using nunit_use_project_file doesn't fix anything.


I submitted the same question and attached logs in private scope, as I think I cannot make them public :)


Please sign in to leave a comment.