NUnit runner crashed, cannot find Test dll

Hi,
    I'm using TeamCity Professional 5.1.5 (build 13602). I have a project which builds a Visual Studio 2010 solution using the Visual Studio (sln) runner, and also runs unit tests using NUnit 2.5.5. The project seems to compile fine, but the Team City NUnit runner crashes. The build log's attached.
    It seems to me that NUnit is looking for my test dll in the wrong place (the TeamCity plugin directory).
    For the record, I tried telling NUnit the location of the test dll using a path relative to the solution path and an absolute path (in the "Run Tests from" text box), but I got the same error.

Relative path:
    DRA.Test\MCImage.Test\bin\Release\MCImage.Test.dll

Absolute path:
    %teamcity.build.checkoutDir%\DRA.Test\MCImage.Test\bin\Release\MCImage.Test.dll


    Cheers,
Darío



Attachment(s):
DRA_VS2010_DRA_VS2010_Unit_Tests_Release_0.11.log.zip
5 comments

Bump! Any hints on troubleshooting this? If I look in the server's file system, the dll is there. But Team City cannot find it, so I'm at a loss here...

0

Darío,

Seems like some misconfiguraiton. Can you please check that the tests can be run on the agent using NUnit console? If yes, can you provide the command used?

There is also alike issue with comments that can be helpful to resolve your case.

0

Hi Yegor,
   I found the cause of the problem, and it wasn't Team City's fault. Even more, when I reenabled the NUnit Tests today, the error Team City reported was different from last time. It said something like:

Unit Error: System.IO.FileLoadException: A procedure imported by 'MImage.dll' could not be loaded.

   Which pointed me in the right direction. My test dll, MCImage.Test, uses a C++/CLI dll called MImage. In turn, MImage uses a native C++ dll called Image. MCImage.Test's reference to MImage had CopyLocal set to true, so everything was OK upto there. However, when I went to MCImage.Test\bin\Debug and dumped MImage.dll into Dependency Walker, I saw that it was NOT fetching Image.dll from Team City's work directory, but from an outdated workspace folder.

   So the NUnit Runner crashed because it was trying to use an outdated version of Image.dll. My theory was proven when I updated the workspace folder, built the test from there and the tests ran in Team City like a charm.

   And why was Team City fetching Image.dll from there? Simple: our development boxes have Windows' PATH environment variable pointing to either the Debug or Release folder of our workspace. And the Team City used to be a development box. So there you have it.

   My solution, in order to allow eventual development on the Team City server, was to add to our Nant build script a few lines for copying native dll's like Image.dll to the respective Tests' folders. Not very elegant, but works.

Cheers, hope this helps someone

0

Darío,

Thank you for the description of the solution.

(Thinking how TeamCity can help track such misconfiguraitons...)

0

I'd recommend printing on Team City's log the locations where the dll's are sought, including those where it is not found, Fusion-logging style

0

Please sign in to leave a comment.