Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

NUnit 3.2.1 + TeamCity: Could not load file or assembly 'nunit.framework'

I've recently updated to TeamCity 9.1.6 to run my new unit tests based on NUnit 3.2.1. But now I'm having trouble running the tests:

I've selected the NUnit3 executor in build steps, configured it accordingly:

Build step configuration

When building, I get an error: "Could not load file or assembly 'nunit.framework' or one of its dependencies. The system cannot find the file specified.".

Build log

Everything should be fine, the paths are fine, the assembly is in the path of the Test assembly, everything is built in AnyCPU configuration. There's also the error stating that NUnit version is not a release version, which I think is bullshit, it's a release on NUnit website. And the error doesn't seem to break anything (it was present even when I had an error before the 'nunit.framework' error, and when I fixed that one, the build got further).

Any leads appreciated!

UPDATE: Running tests using a Command Line runner and running that same nunit3-console.exe works fine. So I guess this is a NUnit runner specific problem. Still, suggestions are welcome on how to fix this.

UPDATE 2: I tried downgrading both the solution package and the NUnit-Console used by TeamCity to 3.0.0 - still, same result.

UPDATE 3: As I've suspected, TeamCity support confirmed that the message about "NUnit version not being supported" is a faulty one, and shouldn't affect anything.

like image 527
Jurijs Kastanovs Avatar asked May 03 '16 05:05

Jurijs Kastanovs


1 Answers

I had the same problem with TeamCity 10.0.1 (build 42078) and NUnit 3.4.1. And it turned out to be completely my fault. I'm posting it here as someone else can stumble into the same problem and this can save them some time.

It turned out that the problem was in the "Run tests from: " setting in my build configuration.

enter image description here

I had **\*.Test.dll. That was accidentally picking up dlls for \obj\**\ directories (where there is no nunit.framework.dll present). Once I changed the setting to **\bin\%BuildConfiguration%\*.test.dll it all works fine.

Note: %BuildConfiguration% is a parameter which specifies your preferred build configuration on the TC (like Debug / Release / CIBuild etc.)

like image 153
milanio Avatar answered Oct 04 '22 18:10

milanio