Assign multiple test categories using TestCategoryAttribute

I am using TestCategoryAttribute to filter which tests to run during builds and wandered, how to -how to assign multiple test categories.
According to constructor documentation only single category can be specified.  However TestCategories Property (plural!)can return multiple categories.

Grouping Tests into Test Categories: You can add an automated test to one or multiple test categories using a test attribute. Each test can belong to multiple test categories.
The recommended approach from MSDN How to: Group and Run Automated Tests Using Test Categories is to specify multiple TestCategory attributes like the following

[TestCategory("Nightly"), TestCategory("Weekly"), TestCategory("ShoppingCart"), TestMethod()]
public Void DebitTest() { }
shows how enums can be used instead of strings.
It also explains, that TestCategories Property can be used in derived custom attributes.
posted @ Sunday, September 30, 2012 11:36 AM
Print

Comments on this entry:

No comments posted yet.

Your comment:



(not displayed)

 
 
 
 
 

Live Comment Preview:

 
«July»
SunMonTueWedThuFriSat
293012345
6789101112
13141516171819
20212223242526
272829303112
3456789