C# 如何通过程序将测试用例添加到microsoft测试管理器

C# 如何通过程序将测试用例添加到microsoft测试管理器,c#,visual-studio,tfs,testcase,microsoft-test-manager,C#,Visual Studio,Tfs,Testcase,Microsoft Test Manager,我在excel文件中有一组测试用例。我需要通过c#程序/或一些脚本语言将其导入microsoft测试管理器。我在网上搜索过,但大多数答案都指向使用“TestCaseMigratorPlus”。此外,他们使用测试用例迁移器将测试用例从Excel导入TFS(Team Foundation Server)而不是MTM。但我需要通过我的程序来完成。我可以使用c#程序使用测试用例迁移器吗?或者有没有办法将测试用例添加到MTM中?谢谢你的帮助。 此外,我还检查了类似的帖子,但对我来说,它们未能解决我的问题。

我在excel文件中有一组测试用例。我需要通过c#程序/或一些脚本语言将其导入microsoft测试管理器。我在网上搜索过,但大多数答案都指向使用“TestCaseMigratorPlus”。此外,他们使用测试用例迁移器将测试用例从Excel导入TFS(Team Foundation Server)而不是MTM。但我需要通过我的程序来完成。我可以使用c#程序使用测试用例迁移器吗?或者有没有办法将测试用例添加到MTM中?谢谢你的帮助。
此外,我还检查了类似的帖子,但对我来说,它们未能解决我的问题。

您可以使用TFS API创建测试用例。下面是一个示例代码,它完全解释了这个过程

     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.Actions.Clear(); 
     currentTestCase.ITestCase.Owner = testManagementTeamProject.TfsIdentityStore.FindByTeamFoundationId(sourceTestCase.TeamFoundationId); 

     currentTestCase.ITestCase.Flush(); 
     currentTestCase.ITestCase.Save(); 

这对我帮助很大!。。谢谢,博客解释了大部分需要的东西。再次见到你。