10

When I run my Unit Tests, all tests pass, but instead of "Test run succeeded" or whatever the success message is, I get "Test run error" in the little bar that tells me how many of my tests pass, even though all my tests passed.

When i click the text, I'm taken to a page that tells me the following two things happened:

Warning: conflict during test run deployment: deployment item '[...]\Booking.Web.dll' directly or indirectly referenced by the test container [...]\Booking.Web.Tests.dll cannot be deployed to 'Booking.Web.dll' because otherwise the file '[...]\Booking.Web.dll' would override deployment item '[...]\Booking.Web.dll' directly or indirectly referenced by '[...]\Booking.Web.Tests.dll'

Error: Cannot initialize the ASP.NET project 'Booking.Web' Exception was thrown: The website could not be configured correctly; getting ASP.NET proccess information failed. Requesting 'http://localhost:54131/VSEnterpriseHelper.axd' returned an error: The remote server returned an error: (500) Internal Server Error.

I don't understand half of what it's complaining about. How do I get rid of these errors?

(And for reference: Booking.Web is an ASP.NET MVC 2 project, Booking.Web.Tests is a Test project, [...] is the full local path to the projects in my environment, in most of the cases above to the /bin/debug/ folder inside the Booking.Web project)

Update: As instructed, I looked for more info in Event Viewer. Here's what I found:

3008 A configuration error has occurred.
5/8/2010 2:26:15 AM
5/8/2010 12:26:15 AM
4ffbe9180c3d4c02adb9ac4d61dd0928
1
1
0
4484bbf4-1-129177519750954331
Full
/
D:\...\Booking.Web\
AASLOEG

1876
WebDev.WebServer40.EXE
Aasloeg\Tomas
ConfigurationErrorsException
Could not load file or assembly 'Ninject.Web.Mvc, Version=2.0.0.0, Culture=neutral, PublicKeyToken=79764a4ef1548af1' or one of its dependencies. Strong name signature could not be verified. The assembly may have been tampered with, or it was delay signed but not fully signed with the correct private key. (Exception from HRESULT: 0x80131045) at
System.Web.Configuration.CompilationSection.LoadAssemblyHelper(String assemblyName, Boolean starDirective) at
System.Web.Configuration.CompilationSection.LoadAllAssembliesFromAppDomainBinDirectory() at
System.Web.Configuration.CompilationSection.LoadAssembly(AssemblyInfo ai) at
System.Web.Compilation.BuildManager.GetReferencedAssemblies(CompilationSection compConfig) at
...stack trace in absurdum.

Tomas Aschan
  • 58,548
  • 56
  • 243
  • 402

2 Answers2

9

First of all - you have Code Coverage enabled. You can read here about it. So there is no problems with Unit Tests. This is code coverage problem.

Second thing - this warning is ok - never mind about it.

Third thing - this error - this is the key problem.

There can be different problems - most common is that you should refference more assemblies. To find out what exactly should be loaded you must go to Event Viewer and look at at Windows Logs->Application

er-v
  • 4,405
  • 3
  • 30
  • 37
  • I find an error with Ninject.Web.Mvc (for which I downloaded the source and built against Ninject 2 and ASP.NET MVC 2 dlls myself...) but I haven't been able to get rid of the error, since I can't figure out why loading the dll isn't working properly. I'll update my post with the info I find in Event Viewer. Also, as you say I have code coverage enabled - but which part of this are you saying is affected by that? – Tomas Aschan May 10 '10 at 20:50
  • Well, you can turn off code coverage. But if you need it you should understand why this problem apears. Actualy if you've builded them by yourself have you signed them? 'Ninject.Web.Mvc, Version=2.0.0.0, Culture=neutral, PublicKeyToken=79764a4ef1548af1 - means that it looks for the signed assembly. I understand - this looks realy strange that you can run web site but code coverage for some reason nobody can understand requires more assemblies to be included in application. – er-v May 11 '10 at 07:28
  • I believe I havent signed it - should I? How do I? Or could I just wait until Ninject releases a new version targeting .Net 4 and this will go a way automagically? – Tomas Aschan May 12 '10 at 19:41
  • Ok, I've downloaded Ninject 2 and compiled Ninject.Web.Mvc and added it to the sample mvc project, turned codecoverage on and reproduced your error. To get rid of it you should do the following. Turn off signing for Ninject.Web.Mvc. You can do it in Project->Properies->Signing tab and uncheck Sign The Assembly checkbox. Rebuild. Replace signed assembly with unsigned. The error should go away. – er-v May 13 '10 at 04:12
  • Thanks a lot! I can't mark your answer as the correct one now - I assume that's because the bounty period has expired, but you should have recieved the bounty points anyway, right? Again, thanks! – Tomas Aschan May 17 '10 at 07:30
6

I had the same error related to MS-Test complaining that a DLL could "override deployment item blah.dll".

This was happening because I was running MS-Test for multiple DLL's at once like so:

mstest.exe /testcontainer:Tests.web.dll /testcontainer:Tests.svcs.dll /testcontainer:Tests.core.dll

When MS-Test was running this, it tried to take all the output DLL's from the tests and place them in out /Out directory of the test run. In my case, Tests.svcs.dll and Tests.core.dll both referenced the same assembly (Core.dll) and therefore it tried to copy that DLL to the same spot twice (thus causing the warning).

To resolve this, I separated the test runs for each assembly which gave each test run it's own /Out folder for output DLL's

mstest.exe /testcontainer:Tests.web.dll

mstest.exe /testcontainer:Tests.svcs.dll

mstest.exe /testcontainer:Tests.core.dll
Jeffrey Harrington
  • 1,797
  • 1
  • 15
  • 24
  • It is not always possible to do so. In my case I am running the test in CI server and I have to run them all together to generate a single result file – Ido Ran May 03 '12 at 11:11
  • What CI are you using? I run all of my tests in Hudson/Jenkins and the plugin we use to display results is able to merge multiple results files. We just give it a wildcard like so: /TestResults/*.trx – Jeffrey Harrington May 03 '12 at 15:56
  • I am using Jenkins. Which plugin do you use to process the trx results? – Ido Ran May 03 '12 at 17:59
  • We are using the [MSTest Plugin 0.7](https://wiki.jenkins-ci.org/display/JENKINS/MSTest+Plugin). For a screenshot of of configuration you can [click here](http://i.imgur.com/lzQgA.png). – Jeffrey Harrington May 07 '12 at 18:59