Home Ask Login Register

Developers Planet

Your answer is one click away!

Pranav February 2016

How to add test cases to microsoft test manager through program

I have a set of test cases in an excel file. I need to import it to microsoft test manager through a c# program/or some scripting languages. I searched web but most of the answers are pointing towards using "test case migrator plus". Also they are using test case migrator to import test cases from excel to TFS (team Foundation Server) and not to MTM. But I need it to be done through my program. Can i use test case migrator using a c# program? Or is there any way to add Test cases to MTM? Thank you for the help. Also, i have checked posts similar to upload test cases from excel to microsoft test manager 2013 , but to me, they failed in addressing my problem.


chief7 February 2016

You can use the TFS API to create test cases. Here is some sample code from a blog post which fully explains the process.

     ITestCase testCaseCore = testManagementTeamProject.TestCases.Create(); 
     currentTestCase = new TestCase(testCaseCore, sourceTestCase.ITestSuiteBase, testPlan); 

     currentTestCase.ITestCase.Area = sourceTestCase.Area; 
     currentTestCase.ITestCase.Title = sourceTestCase.Title; 
     currentTestCase.ITestCase.Priority = (int)sourceTestCase.Priority; 
     currentTestCase.ITestCase.Owner = testManagementTeamProject.TfsIdentityStore.FindByTeamFoundationId(sourceTestCase.TeamFoundationId); 


Post Status

Asked in February 2016
Viewed 1,517 times
Voted 11
Answered 1 times


Leave an answer

Quote of the day: live life