views:

372

answers:

2

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

+1  A: 

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.

FrederikB
Ok, I tried once more with 2.5.3 and in the end I got it working when I found that the /framework parameter had changed. Seems to work with multi assembly. Thanks!/Per
Per Salmi
A: 

I has the same problem. I got around it by creating an nunit project in the GUI that includes multiple dlls. Then I can run it with nunit-console.

Lance Fisher