In our current development environment we use MS Test for our unit testing and one thing that has been bugging me for a while is that if you remove the Ignore attribute from a test method, recompile and then try and run the test nothing happens and but you get a message in the status bar saying "No tests were run because no tests are loaded or the selected tests are disabled".
So I didn't really understand what that meant and usually ended closing Visual Studio, re-opening it and seeing if that fixed the problem, it didn't so I finally googled it and came across this MSDN article, in which it nicely explains that after adding the IgnoreAttribute to the unit test "The test is disabled. In the Properties window, the Test Enabled property is automatically set to False."
Now what should happen is when you remove the IgnoreAttribute the Test Enabled property is automatically set to True. However this does not seem to the case so after removing the IgnoreAttribute you need to either:
1. Open the Test View, select the ignored test, press F4 to display the properties window and set the Test Enabled property to True.
Or
2. Open the Test List Editor, selected the ignored test, right click and select "Enable" from the context menu.
I hope this helps anyone with future MS Test issues.
21 comments:
Thanks man- helped me out. What an annoying message!
Helped me too. Thanks.
I was getting the "No tests were run because..." message too, but it was because I had accidently deleted all my tests (thinking I was only deleting the test runs.
The test code was still there but stubbornly refused to run any tests until I discovered that all the test methods were missing the [TestMethod()] attribute. Adding this back made all my tests reappear.
HTH
Robert
Thanks.
I was closing th eproject and deleting the .sou file.
This will be much better.
Thanks a lot. This was a pain in the neck until I saw your post.
Thanks.
Thank you!
Nice one!
one day MS will get helpful with their errors!
Thank you for this post! Spent most of my Friday afternoon trying to figure this out before finding this solution.
you made my day after hours of despair. re-adding [TestMethod()] to all the test methods is the key... thx for that!
good and thanks...helped me
thanks mate...it helps
thanks mate
thanks a lot
thanks
Rahul Mehta
thanks
Restarting VS2010 seems to reset this problem as well.
Yes to be fair restarting VS2010 would do it but maybe a little bit of overkill :-)
Thanks for this blog.
Restarting VS did not reset the test for me, and I simply couldn't figure out what the problem was.
Thanks . It is very helpful for me .
Helped me too. Thanks
Post a Comment