I have a set of unit test , marked with category attribute like so:
[TestCategory("Bugs"), TestMethod]
I can run the tests from the console as described here http://msdn.microsoft.com/en-us/library/dd286683.aspx.
And I Run them locally using post build events when needed, Is there a way to integrate the TestCategory
Into the visual studio Test Explorer?
Run tests in Test Explorer If Test Explorer is not visible, choose Test on the Visual Studio menu, choose Windows, and then choose Test Explorer (or press Ctrl + E, T). As you run, write, and rerun your tests, the Test Explorer displays the results in a default grouping of Project, Namespace, and Class.
Test category means one type of test or group of tests specified by rule under sub. (4) for similar materials or classes of materials or which utilize similar methods or related methods.
In your Test Explorer, right click and select "Group by -> Traits".
MSDN
If all you want to do is group them, click on the icon to the right of the "Run Tests After Build" icon and select "Traits". You'll see them sorted by TestCategories.
Update: Confirmed that this also works for VS2012 (in addition to VS2013)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With