Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

NUnit-console 2.5.4 not capable of running multiple assemblies?

I am having problems running tests with the command line NUnit test runner.

I am using version 2.5.4 with .NET 4 on an x64 machine.

Using the following line results in a failure "Could not load file or assembly 'bar' or one of its dependencies. The system cannot find the file specified."

nunit-console-x86 foo.dll bar.dll /framework=4.0.30319

If I reverse the dll file names it complains about not finding 'foo' instead...

It works if I run them separately like:

nunit-console-x86 foo.dll /framework=4.0.30319

Also the tests of the second file works if I run:

nunit-console-x86 bar.dll /framework=4.0.30319

Before upgrading our projects to 4.0 we used NUnit 2.5.2 and the same command line tool options and at that point the runner worked well with multiple assemblies. It seems like the ability to run tests on multiple files at the same time is broken...

Anyone that can see the same behavior or does it work indicating that my environment is somehow broken?

/Per

like image 427
Per Salmi Avatar asked Apr 16 '10 14:04

Per Salmi


1 Answers

Assembly loading behaviour has changed between 2.5.4 and 2.5.3. It was causing problems for us, so we reverted to 2.5.3, since that still supports the 4.0 framework.

We use nunit-console.exe 2.5.3 with multiple assemblies in our msbuild script, which looks like this:

    <Exec Command="%22$(NUnit_Install_Directory)bin\net-2.0\nunit-console.exe%22
 /noshadow @(TestableAssemblies, ' ')  /xml $(BuildFilesPath)\NUnit-Results.xml" />

On execution, it fills out like this (edited for readability):

"c:\Program Files\NUnit 2.5.3\bin\net-2.0\nunit-console.exe" /noshadow D:\BuildAgent\GojiSoft.Application.Test\bin\Release\GojiSoft.Application.Test.dll D:\BuildAgent\GojiSoft.Common.Test\bin\Release\GojiSoft.Common.Test.dll /xml D:\BuildAgent\work\2f016459feee51ce\Build\NUnit-Results.xml

We don't use a 64bit machine for our unit tests, so YMMV.

I have a blog post about the addtional modification your should make to the nunit-console-x86.exe.config here: Getting .Net 4.0, Team City, MSBuild and Nunit to play nice.

like image 134
Frederik Avatar answered Oct 21 '22 01:10

Frederik