Today, MSTest annoyed me again, as it did once before (see the post Message in Visual Studio 2010: Changes to your tests are no longer automatically displayed).
When running the test-suite of TextGen, I discovered, that one test was not run at all.
The test seemed to be ok. Neither the test class nor the test method were ignored:
But when I tried to execute the test, Visual Studio issued the following message, and the test was not run:
Message from MSTest: “No tests were run because no tests are loaded or the selected tests are disabled.”
I did not understand that and Google did not provide any satisfactory answers, just some conjectures.
So I played around a bit: If I changed just a single character of the method’s name, MSTest executed the test again. If I renamed that test, but added a new test method with the name in question, it resulted in the same message.
Thus, it’s all about the test method’s name!
Somewhere it must be stored that a test method with that name shall be treated as disabled. Smells like test run configuration, which sounds like the vsmdi-file in the context of MSTest. Doubleclicking my vsmdi-file showed me a list of all my tests (“test list”) – and my test was shown in gray:
But why that?
Now the path left to go was not all too long: Inspecting the properties of the test revealed the guilty, the test was disabled:
I’ve had no idea why this property was set to false, since I was not aware of it’s very existence, but that was the reason.
Again – easy if you know. But one can fall into despair, when you just want to run your neat little test but you can’t.
BTW, ReSharper-test runner for MSTest ran the test nevertheless. But – test first is much faster with the native MSTest test runner.
Thanks!!
ReplyDeletewow - thanks! been trying to figure this out all afternoon.
ReplyDeletethank you!
ReplyDelete