You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have a test class that inherits test methods from a base test class, but I want to apply a TestCategory from the derived class in order to filter tests to run. The current implementation only looks at the TestCategory starting at the class that declares the test method, rather than the class being enumerated. But since TestCategory is inherited, I think it would make sense for it to include all categories starting at the class being enumerated.
I have a working implementation of this in a fork and am opening this issue to determine if the change is desired or if it's working as intended.
There's also a question about how assembly-level TestCategory attributes should work in this case. The code currently only considers the assembly containing the test method and not the assemblies containing the test class hierarchy. My fork changes it to only consider the assembly containing the test class being enumerated.
Hey @spanglerco, thanks for pointing this out. Marking this as an enhancement and is up for grabs for a contribution.
Just adding to the expected behavior a little, TestCategory should not override but add another category to the class. A test class can take multiple test categories, so for derived classes defining TestCategory should also show up when filtering for their base class category
[TestClass][TestCategory("base")]publicabstractclassBase{[TestMethod]publicvoidTestSomeBaseInterfaceMethod(){}}// With test category[TestClass][TestCategory("derived")]publicclassDerived:Base{}// Without test category[TestClass]publicclassDerived2:Base{}
Using the filter "base" should run both Derived and Derived2 classes whereas using filter "derived" should only run Derived class.
Will be happy to take contribution with appropriate tests and expected behavior.
Description
I have a test class that inherits test methods from a base test class, but I want to apply a TestCategory from the derived class in order to filter tests to run. The current implementation only looks at the TestCategory starting at the class that declares the test method, rather than the class being enumerated. But since TestCategory is inherited, I think it would make sense for it to include all categories starting at the class being enumerated.
I have a working implementation of this in a fork and am opening this issue to determine if the change is desired or if it's working as intended.
There's also a question about how assembly-level TestCategory attributes should work in this case. The code currently only considers the assembly containing the test method and not the assemblies containing the test class hierarchy. My fork changes it to only consider the assembly containing the test class being enumerated.
Steps to reproduce
Expected behavior
Derived.TestSomeBaseInterfaceMethod has both base and derived test categories:
![image](https://user-images.githubusercontent.com/7519484/46781180-00a29700-cce6-11e8-974a-6331c70861fa.png)
Actual behavior
Derived.TestSomeBaseInterfaceMethod only has the base test category:
![image](https://user-images.githubusercontent.com/7519484/46781388-f3d27300-cce6-11e8-884c-81946df4d324.png)
Environment
MSTest 1.3.2
The text was updated successfully, but these errors were encountered: