Question

I'm trying to write unit tests in MSTest and I've created two TestClasses. When I look at the Test List Editor, the only tests that are shown are the ones that appear in one of the classes.

I can't figure out how to get tests from both of these classes to run. Any ideas?

Was it helpful?

Solution 3

It seemed like cleaning the solution, closing Visual Studio, deleting all the TestResults, deleting the .vsmdi file, and deleting the .ncb file and rebuilding the solution have fixed the problem.

OTHER TIPS

Yes, it is definitely possible, and it's odd that all of your tests aren't showing up. Do both of your test classes have the [TestClass()] attribute?

We have hundreds of test cases in some of our projects. It's not only possible, but essential. Most likely you are missing attributes on the class and/or methods of your test class.

We have two test projects in a solution and the test list shows all tests from both projects.

I remember that I encountered this issue in the past where some test methods were missing from the test list and i suspect that it has to do whith the bug concerning the .vsdmi files. It can happen if your working with source control and allow multiple check out.

Make sure that: All your test classes have the proper attribute. All your methods have the proper attribute.

If it still happens backup you .vsdmi file put it somewhere else and delete the one(s) that are in your project tree (most likely the root). Then close and reopen your project/solution and hit Test/Window/Test View...

Hope this helps!

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top