NUnit tests succeeds when run with NUnit console, some tests fails when run as TeamCity build step. Same machine

0

I have a DLL with NUnit tests. A few of the tests (not all) in that DLL fail when TeamCity tries to run them as a build step. But when I run them (on the same computer as TC) using a stand-alone version of NUnit (same version) all tests pass.

I have tried to copy the settings from TC the best I can but I'm still getting different results while the tests are being run on the same machine.

When running the NUnit console I'm using the same assembly built by TC.

These are the parameters I'm using in the "nunit-console.exe":

PS Downloads\NUnit-2.6.4\bin> .\nunit-console.exe "pathToDll" /framework:net-4.0 /process:multiple

And this is what I'm using in TC.

A picture of my TC NUnit settings, they are described in more detail below

These are the TC settings in text:

  • NUnit runner: NUnit 2.6.4
  • .NET Runtime Platform: auto (MSIL)
  • .NET Runtime Version: v4.0
  • Run process per assembly: true
  • Reduce test failure feedback time: true
  • .NET Coverage tool:

Any clues to what could be creating this difference or knowledge about how exactly TC is running NUnit so I could try and replicate it on my dev machine?

The actual error I'm getting when the tests are failing through TC is: System.IO.FileLoadException : Could not load file or assembly 'Castle.Core, Version=3.3.0.0, Culture=neutral, PublicKeyToken=407dd0808d44fbdc' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)

I have searched both the entire solution for that assembly and on the computer where TC runs for this version of Castle.Core, which I'm not finding. I don't understand why it's trying to load this file just when it's being run by TC and not any other times...

I've failed to locate the actual NUnit runner that TC is using. Anyone know where that resides?

What I've tried:

Remove every file/folder/dll with the name Castle.Core from the TC computer and rebuilt the project.

Run the NUnit DLL through nunit-console and nunit GUI (with or without "project")

Thanks in advance 😊

PS. Yes, I know we should update to NUnit 3 .DS

.net
nunit
teamcity
nunit-console
nunit-2.6
asked on Stack Overflow Jul 25, 2018 by ILOABN

0 Answers

Nobody has answered this question yet.


User contributions licensed under CC BY-SA 3.0