Search code examples
unit-testingtfsmstestbdd

Building a report against TFS showing number of unit tests linked to a requirement?


Is there a way to build a report using the MS Team Foundation Server API or other means so that I can count the number of unit tests which have been written against a requirement? ( or user story )

Approaches under consideration: (1) Create an attribute on test methods so we can note the requirement ID on the unit test method. Under this option, I am not sure how we could walk the test results and grab the requirement ID.

(2) Put the requirement ID into the test method name (Ugly)

(3) Start doing BDD.

Any other options are welcome...

Thank you in advance for your time.


Solution

  • You can either do this with MS Report Builder or buy writing a custom build action (using Microsoft.TeamFoundation.TestManagement.Client.dll) which interrogates your code. I think ReSharper also has in built functionality for checking test coverage.

    I'd just write a report though.

    This is a more detailed explanation from MS on the use of the API: http://social.msdn.microsoft.com/Forums/en-US/tfsgeneral/thread/22bb54bd-d939-4790-b668-5d0523c24461/