TAGS :Viewed: 3 - Published at: a few seconds ago

[ Unit Tests are failing on a "Build failed" in the Session window with no message providing a reason for failure in Visual Studios 2010 ]

I had recently installed VS 2010 on my local machine, and cannot seem to get Resharper 5.1 and the unit tests to work correctly. Whenever I try and run Unit tests I get a "Build failed" with the test icon remaining gray, but with no info in the output window and no discernible reason why.

The Unit Tests run perfectly fine when doing a nant build.

Running a previous branch of the code on VS 2008 does not have this same issue as a result.

Any ideas?

Answer 1

Check your build configuration. If you're using a build configuration that is set to not build your test projects (like your release configuration) then the Resharper test runner will fail this way. The output looks like a perfectly successful build but if you inspect the output you'll find your tests are not in it.

Another symptom of this issue is if you set the test runner to not build as suggested above, next time you attempt to run the test it will be crossed out in the test runner.

Build configurations can be found in Build->Configuration Manager in Visual Studio.

Answer 2

If you change the build settings to 'never build' in the unit test sessions window, it works ok (providing you pre-build the dll using visual studio). It appears to be a Resharper bug.

Answer 3

In my case this did solve the issue: http://www.shirmanov.com/2011/07/project-has-not-been-built-resharper.html

I had the UnitTests set "to not build" in my solution configuration. The above mentioned article shows this very detailed.

Answer 4

In my case I was missing a DLL that was not added to the project. I added it, cleaned and build and everything was okay.

Answer 5

Verify in Visual Studio Configuration Manager that your test projects are marked to be build.