Search code examples
.netvisual-studio-2012mstestvs-unit-testing-frameworkordered-test

How can I assign a category attribute to an orderedtest?


I have a category of unit test methods ("Serialization") all marked with the CategoryAttribute so that I can sort the Test Explorer pane in VS-2012 by "Trait" like this:

Test Explorer Pane

I have added an Ordered Test (called serialization.orderedtest) to a Unit Test project in my solution and assigned all of these unit test methods to run in a particular sequence.

My question: How can I assign my "Serialization" category to this ordered test object so that it is organized with the others in this view?

** EDIT **

It's been suggested that there might be a Properties option in the right-click context menu for the test items in the VS-2012 Test Explorer. Alas, there is not...

enter image description here


Solution

  • I can verify that in both 2010 and 2012 there is no "Test Categories" field for Ordered Tests. In Coded UI tests there are, but I do not see any way at this time to set an Ordered Test to a category.

    That is, through the Test View window in 2010, it does show a "Test Categories" property for the Ordered Test. However, attempts at editing the field result in an error when saving the property. So the edit is not saved and the ordered test remains uncategorized.