Tuesday, July 23, 2013

How to: Add users to list of code reviewer in TFS 2012

With TFS 2012 Update 2, we have new feature where we can enable code review in TFS itself. Here are steps to add users to reviewer list.

1. Open TFS Team Web Access
2. It will open in Overview mode
3. In Right side pane, there are options like ACTIVITIES, MEMBERS, ADMINISTRATION
4. ADMINISTRATION link is for Sprint management.
5. For user management - Click on Top Right Setting symbol [Next to Help link]
6. Select Project and select your team Left side panel. Here you can add users you want to. There is Add  button on top. you can add single user or user(s) group. Also you can add multiple Administrators.
7. Once done re-open VSTS and connect team explorer.
8. Create new review request and you will see added user(s) in reviewer list.


Monday, July 22, 2013

Automated Test Run Error: There is no test with specified id {GUID}

Those who use Microsoft Test Manager to run their automation, find this error common and some time irritating. As the error states, it unable to find specific test case in associated build to test plan. There may be other reason for this such as -

1. Change in class name spaces but didn't updated automation association
2. Build assigned to test plan is not correct or old one
3. Missing test assemblies in assigned build


1. Check if your test assemblies are there in the build drop folder
2. Remove the automation association and re-associate automation method reference.
3. Get the test case ID and make sure it is part of test suite in test plan.
4. Check if associated automated test name is correct. Error states that you are running your test against build which doesn't have associated test in it.
5. Queue new build and once succeeded - assign it to your test plan and make sure this build has all tests which are associated with your automation. 


Wednesday, July 17, 2013

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.