VSTS - How to associate work items to tests

Every test you create whether it is Unit, Manual, Web or Load can have work items associated to them. If you’re working with the MSF Agile process the work item Scenario is a detailed requirement, a bug is a work item, risk is documented in a work item. You have the ability to associate work item(s) to your tests.  Remember that work items are stored in the TFS as is test results, you can run queries against anything stored in the TFS, you therefore have the ability to report on the testing of requirements, risk, bugs. Think about knowing that a bug has been retested and that it’s passed. I know prior to VSTS we used a lot of excel spreadsheets and human intervention to document this information, now it’s a click of your mouse, select the work item to associate and your done. Run your queries and the information displays.


How to associate a work item to a test …


To access a tests property open the window Test View which gives you a view of all your tests created. Right click on a test and select properties, the Properties window will open under “Misc” you will find the property Associate Work Item. Note that you can move the Properties window to the right of your screen under Team Explorer/ Solution/Project and Test View.   You can also do this using Test Manager.


Next Steps:

1.       Click the button icon in the Associate Work Item property field

2.       Window opens with an Add button enabled

3.       Click the Add button

4.       The Work Items Picker window opens

5.       Select the Team Project your working on

There are three ways to get the work item(s) you want to associate you can select a query, key in the work item identifier number, use the work item title and type. The easiest way would be to find work items by query.

6.       By default the option “Saved query:” is selected click the dropdown and select query named “All Work Items”

7.       Click the Find button

The Select items to add to the work item list displays all work items in your project and by default they are all selected.

8.       Click the Unselect All button

9.       Pick a scenario or bug or any work item you please

10.   Click OK

Your returned to the previous window with the work items identifier’s displayed. If you’ve selected incorrectly you can click on an id and remove or click Details to see the actual work item.

11.   Click OK again

The test property Associated Work Item now populates with the work items identifier number you selected.


Picture of the windows talked about above:


Manual Test Property:




Work Item Picker:




Run queries and see what scenarios your tests are covering, if your real good query to see if what scenarios don’t have test associated.


Try it out … Testa