Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is it possible to have multiple 'TestClass'es in MSTest?

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?

like image 217
Jared Avatar asked Dec 07 '25 12:12

Jared


1 Answers

(For the next one who arrives here via google looking for answers)

In my case, none of the above applied.

The key element to make all test files (and the classes therein) show up in the Test Explorer (VS2019) was adding the public keyword to each test class. Didn't need it before with Nunit, but we moved to MSTest and then the tests disappeared. Adding public made them show up again:

[TestClass]
public class TestBibTeX    // <-- +public+
{
  ...
like image 111
Ger Hobbelt Avatar answered Dec 12 '25 12:12

Ger Hobbelt



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!