如何为每个 C# TestMethod 单元测试自动创建 TFS 测试用例
我正在使用 TFS 2010、VS2010 和 C#。我需要将每个需求链接到与该需求相关的单元测试或测试。我发现为了将测试链接到需求,TFS 需要每个 [TestMethod] 单元测试都有一个测试用例。只有这样我才能将需求链接到测试用例,而测试用例又与自动化单元测试相关联。我正在寻找一种快捷方式,以便可以为所有现有测试自动创建测试用例。理想情况下,TFS 测试用例描述来自 [TestMethod] 标头注释。
I'm using TFS 2010, VS2010 and C#. I need to link each requirement to the unit test or tests associated with that requirement. I've found that in order to link Tests to requirements, TFS requires a Test Case for each [TestMethod] unit test. Only then can I link the Requirement to the Test Case which in turn is associated with the automated unit test. I'm looking for a way to shortcut this so that Test Cases can be created automatically for all exiting Tests. Ideally the TFS Test Case description would come from the [TestMethod] header comments.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
如果您只想创建几个测试用例,可以直接从 Visual Studio 打开测试窗口,选择您的测试,右键单击并选择“从测试创建测试用例”。您必须打开测试项目才能在测试窗口中查看自动化测试。
http://msdn.microsoft.com/en-us/library/dd380741 .aspx#NewTestCase
如果你想从测试程序集中导入一堆自动化测试,你可以使用测试管理的命令行工具,称为 tcm.exe(你可以在 Common7\IDE\ 下找到它)您的 Visual Studio 位置)。以下命令即可解决问题:
tcm testcase /import /storage:[测试程序集] /collection:[url] /teamproject:[您的团队项目]
您还可以指定要导入的测试的类别或优先级。有关详细信息,请参阅:
http://msdn.microsoft.com/en -us/library/dd465191.aspx#CreateTestCases
希望这有帮助。
If you just want to create a couple of test cases, you can do it directly from Visual Studio by opening the Test Window, select your test, right-click and choose "Create Test Case From Test". You must have your test projects opened in order to see your automated tests in the Test Window.
http://msdn.microsoft.com/en-us/library/dd380741.aspx#NewTestCase
If you want to import a bunch of automated tests from a test assembly, you can use the command-line tool for Test Management, called tcm.exe (you can find it under Common7\IDE\ of your Visual Studio location). The following command will do the trick:
tcm testcase /import /storage:[test assembly] /collection:[url] /teamproject:[your team project]
You can also specify the categories or the priorities of tests you want to import. For more information, see:
http://msdn.microsoft.com/en-us/library/dd465191.aspx#CreateTestCases
Hope this helps.