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)
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 using below code :
You can find tool source HERE
And you are done here. I hope this will help you. Please post your comments/feedback to make this better.
Thanks,
Vivek
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)
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 using below code :
You can find tool source HERE
And you are done here. I hope this will help you. Please post your comments/feedback to make this better.
Thanks,
Vivek
Hi Vivek, thanks for making this tool available to the community. Is it possible to get the source? I'd like to include in a java based framework. Thanks... Donovan
ReplyDeleteHi Vivek,
ReplyDeleteThe steps are very clear and thanks for that. However, If I click 'HERE' link to take the source, the webpage is not available. Please help me to get the tool exe.
Thanks
Thanks for your feedback..!!
ReplyDeleteTry this link - http://sdrv.ms/18bc1d8
This should work for you.
Hi Vivek,
ReplyDeleteI would like to understand the code and its approach.
Can u pls give me ur FB link so that I can talk to you??
It'll be a great help for me.
Thnx
Hi
DeleteThanks for your reply.
Mail me at vivekbansod@gmail.com or chat. happy to help you.
Hi Vivek,
ReplyDeleteThnx for the tool.
Can u pls help me understand the code and behind approach.
It'll be a gr8 help for me.
Thnx.
hey not able to download the tool. please help
ReplyDeletehi vevek, not able to download the tool. please help
ReplyDeleteHi Bhuvanendra,
DeleteThanks for your feedback..!!
Try this link - http://sdrv.ms/18bc1d8
This should work for you.
Hi Vivek,
ReplyDeleteThanks for the detailed steps and tool. I am getting error as 'Value was either too large or too small for an Int16'. Test suite has only 8 test cases.
Please suggest how to fix this.
Thanks!
Hi,
DeleteSeems like something is missing in excel generated by tool. You need to edit excel before you upload results. If possible share the excel generated at vivekbansod@gmail.com
Thanks
I get below error when clicked on ;Upload test run result;
ReplyDelete---------------------------
Test Result Upload Tool
---------------------------
An error occured:
Unable to cast object of type 'Microsoft.TeamFoundation.TestManagement.Client.SharedStepReference' to type 'Microsoft.TeamFoundation.TestManagement.Client.ITestStep'.
---------------------------
Retry Cancel
---------------------------
Hi Swapnil,
DeleteWhich version of TFS/MTM/VSTS you are using? Error states it is about shared steps in test case however tool was developed for TFS/MTM 2010 version where shared steps concept was not introduced. Probably your test cases has shared steps in it and hence the error.
Please let me know if this is the case. Or you can download the code and modify for shared steps.
Thanks,
Vivek
Vivek,
ReplyDeleteI am delighted to see your reply ,.
Yes as you are correct I am using VS 2012 and TFS 2012
By any chance do you have code to accommodate shared step as well ?
Can you provide any hint/guideline on what part of code needs to be updated ?
Hi, I was not able to download your source code can you please send it to me directly at ken.e.adams@gmail.com?
ReplyDeleteHi Ken,
DeleteTry this link - http://sdrv.ms/18bc1d8
Is there any way to update Test Cases into MTM?
ReplyDeleteHi SKG,
DeletePlease share details when you say update test cases in MTM? What information you want to update for test cases in MTM?