How To: Bulk upload Test Case results to Microsoft Test Manager

How To: Bulk upload Test Case results to Microsoft Test Manager

Problem Definition:
Most TFS or Microsoft Test Manager users find it difficult to update test execution result to MTM. Assume that you are done with 100+ test case execution manually and now you want to upload results (Pass/Fail/Block) for all those test cases and also link bugs, test cases to result as needed. Doing this manually is very time consuming. At this time there is no way to support this ask in MTM versions but yes, we can achieve this by writing our own code using TFS SDK APIs.

Resolution:
I came along with this issue some time back and created a tool using TFS APIs which upload results to MTM very smoothly. 
Here is how my tool works:
1. Run tool exe
2. Connect to team foundation server you want to
3.  Select test plan -> Test Suite
4. Click Get Test Case button
5. This will create excel with test cases from selected test suite.
6. There is filter if you want to upload results specifically for manual or automated or all test cases
7.  Open created excel and update it with results (Pass/Fail/Block). Add comments for block and bug Id for failed test cases. (There is column for this.)
8. Once ready, click upload button and your marked test case results will be uploaded to Microsoft test Manager
9. You can view your results from Test tab in MTM

Complete Implementation:

Let's go through step by step code snippet, screen if any. You need to consolidate this code if you want to implement it for you.

1. Connect to team foundation server. This code will show  you connect to dialog box so you can choose/add team server and will allow single project selection only.

2. get Test Plans from selected teal collection and team project above
3. When you select test plan, it will populate drop down with test suites belongs to selected test plan
4. After this, you need to pull out test cases from selected test suite. It will pull out only test cases which are active (Ready to mark results for)
5. Here is code used to create required excel file
6. Step 4-5 will create excel with required columns and test case details. Here is how excel looks - (file will be created at your exe path)
 ID  Test Case Title   Result   Comments   Is Run   Configuration   Assigned To   Execution Type 
 Work item ID  Title of test case from test suite  Pass/Fail/Block   Bug for fail or comment for block   Tool will mark this column if test is already marked  OS, browser etc.  Tester  Manual or Automated 
               
               
               

7. Update this excel with result you want to. Don't forget to add bug for failed case and comments for blocked test case. Once done save and close the excel
8. Now last step is to upload result using above updated excel. Here is code will do that. It will create test run for test plan and for selected test cases. Loop through each test case and mark the result and save to results then test run.
8.1 It will first read the excel and then upload the result

8.2 Now upload results to Test Manager by clicking Upload button.

You can download complete solution HERE
 

And you are done here. I hope this will help you.

Thanks,
Vivek

 

Leave a Comment
  • Please add 4 and 2 and type the answer here:
  • Post
Wiki - Revision Comment List(Revision Comment)
Wikis - Comment List
Sort by: Published Date | Most Recent | Most Useful
Posting comments is temporarily disabled until 10:00am PST on Saturday, December 14th. Thank you for your patience.
Comments
  • Vivek Bansod edited Revision 1. Comment: Uploaded solution

Page 1 of 1 (1 items)