MTM - Test Case State and Reason fields

If you are using Microsoft Test Manager you will notice that the work item Test Case does not contain the field Reason. This statement really isn’t true, there is a reason and it is being set for you but not displayed.

The field Reason indicates why a work item is in a particular state. By default the reason field is being set.  States Active and Ready only have one reason which get sets by default for you. The state Closed has three options however since it is not displayed by default reason is be set to “Obsolete”. The other reasons available for the closed state are “Deferred” and “Duplicate”.

There maybe other reasons that you are closing a Test Case or setting the state to ready. One example is Test Case reviews. For this scenario you may want to add a reason that indicates the Test Case is in the state of ready “For Review” then a second “Review Done.

We can customize the available reasons but that is for another blog. Below are instructions on how to add the field Reason to display in your work item Test Case.

How do I get the field Reason to display:

1. In the main toolbar of Visual Studio select Tools > Work Item Types > Open WIT from Server

image

2. Connect to Team Project Collection window opens where you select the collection then click the Connect button.

3. Select Work Item Type window opens where you select a Team Project and the work item Test Case. Click Ok

image 

4. The Work Item Type editor opens as displayed below and you can scroll through to see all the fields available. Reason’s reference name is System.Reason and it is a string data type.

image

5. Click on the Layout tab where we will add the field Reason to the Test Case.

6. You are looking at a preview of the form layout. Find Group > Column > Group-State > Column. Right click on the second Column and select New Control.

7. The window pane to the right displays. Find Field Name in the adjoining cell click the dropdown arrow and select System.Reason from the listing. Find Label in it’s adjoining cell enter the label you want to display on the Test Case, likely Reason.

Under Column you will see Control – Reason added to the bottom of the listing you can move it up under Control-&State if you want. Where it is in this view is where it will display in the work item.

image

8. Save your changes and refresh TFS depending on how often TFS is being updated the field Reason will display as below in your Test Case work item.

image

Testa Smile