Implementing Traits in custom Visual Studio Test Adapters

Avatar

Terje Sandstrom has written two excellent blogs on using Traits in Visual Studio Test Explorer.

How to manage unit tests in Visual Studio 2012 Update 1 : Part 1–Using Traits in the Unit Test Explorer

Part 2–Using Traits with different test frameworks in the Unit Test Explorer

In this blog, I will describe how you can implement Traits support for a custom Test adapter. [NOTE: This feature is only available in Visual Studio 2012 Update 1] I will use the XML Test Adapter that I had created in this blog. I will add a category attribute for each test case.

My test xml file looks like this now.

image

I modified XMLTestDiscoverer.GetTests to retrieve the category attribute from the XML and add it to the Traits property of the test case.

image

Avatar

Follow    

No Comments.