Geeks With Blogs

Michael Freidgeim's Blog MS .Net Development
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 on Sunday, September 30, 2012 11:36 AM | Back to top


Comments on this post: Assign multiple test categories using TestCategoryAttribute

No comments posted yet.
Your comment:
 (will show your gravatar)


Copyright © Michael Freidgeim | Powered by: GeeksWithBlogs.net | Join free