NUnit runner assembly selection - creates many nunit files instead of one
Using version 10.0.2 (build 42234) (will upgrade soon, promise). I would like to specify assemblies for an nunit runner step like so:
**\bin\Release\*UnitTests.dll
When I do that, TeamCity finds all the relevant files, and then creates a .nunit project file for each one (presumably, this is one for each folder or something?) and then it runs a new instance of nunit for each .nunit project file it has created.
If I change the build configuration so that before this nunit step I move all the files that match my pattern above to a single folder, and also adjust my nunit step to use pattern like
%unitTestsFolder%\*UnitTests.dll
Then TeamCity creates a single .nunit file and runs one instance of nunit console, and then I can use parallelisation command line args etc to make it faster.
I want to use the former style because different unit tests may reference different versions of the same assembly and so cannot be placed in a single folder without conflicting. The question is, in the first configuration can I force team city to create one .nunit project file? Have I misconfigured TeamCity? Or do I have to roll my own test-runner step? (easily done, but non-ideal)
Please sign in to leave a comment.
Could you share why is it relevant for your use case whether one or different nunit files are created?
"Then TeamCity creates a single .nunit file and runs one instance of nunit console, and then I can use parallelisation command line args etc to make it faster."
With multiple nunit files, TeamCity appears to run each nunit file sequentially. With one nunit file, I can use the command line arguments "agents" and "process" to control parallelisation. This reduces unit test run time from ~20 minutes to 8-9 minutes. (Nunit console 3.6.0 currently)
Hi Jonathan,
TeamCity creates one nunit config file for each directory to support backward compatibility with NUnit 2, it relates to an working directory for tests. You could avoid it by adding the configuration parameter `nunit_use_project_file=false` in a build configuration. In this case TeamCity does not create the config file at all and passes required parameters via command line arguments. It is important to know that it might be a reason of a too long command line.
Thanks Nikolay. That works well.
As for a length limit, our current string is ~24k characters. I think the length limit (win '08r2) is 32767, from https://blogs.msdn.microsoft.com/oldnewthing/20031210-00/?p=41553/