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

元气小坏坏 提交于 2019-12-10 12:35:13

问题


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?


回答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.




回答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.




回答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.




回答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.




回答5:


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



来源:https://stackoverflow.com/questions/6061070/unit-tests-are-failing-on-a-build-failed-in-the-session-window-with-no-message

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!