次の方法で共有


Have a unit test project but tests don't show up in TestView?

I recently had to deal with this issue in which I had created a unit test project with references to all the right Visual Studio quality dlls, and a well formed unit test class with all the pretty [TestClass] and [Test] attributes, but for some reason, none of the tests would show up in the test view.

The fix was: Open up the test project in notepad and add the following line in PropertyGroup element:
    <ProjectTypeGuids>{3AC096D0-A1C2-E12C-1390-A8335801FDAB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>

And Walla all tests started showing up in my test list. 

Please note: You'd run into this problem only if you didn't create the unit test project in the kosher way to begin with. Visual Studio takes care of setting the appropiate project type guids if you use it's create test project template.

Ads-By-Microsoft

Comments