NUnit 与 Microsoft 测试管理器的集成 [英] NUnit Integration With Microsoft Test Manager
问题描述
我可以使用 tcm testcase import 命令从 Visual Studio 中创建的单元测试程序集将测试用例导入到 Microsoft 测试管理器.当我尝试导入测试用例但使用 NUnit 程序集时,命令失败,显示未找到要导入的测试".是还有另一种方法可以将在 Nunit 中创建的测试用例导入 Microsoft 测试管理器吗?
I can import test cases to Microsoft Test Manager from unit test assembly created in Visual Studio using tcm testcase import command.When I try to import test cases but using NUnit assembly the command fails saying "No Tests found to import".Is there another way by which I can import test cases created in Nunit to Microsoft Test Manager?
推荐答案
我们能够使用 tcm
导入 MTM,通过添加 TestMethodAttribute
到我们的 NUnit 测试方法.
We were able to pick up our NUnit tests fine using tcm
to import to MTM, by adding a TestMethodAttribute
to our NUnit test methods.
例如:
namespace NUnit.Tests
{
using NUnit.Framework;
[TestFixture]
public class SuccessTests
{
[Microsoft.VisualStudio.TestTools.UnitTesting.TestMethod] //<-- here
[Test]
public void Add()
{
//
}
}
}
使用对 TestMethod
的完全限定引用比 using 指令更受欢迎,因为几个类名在两种实现之间发生冲突,因此这会引入歧义.
Using the fully-qualified reference to TestMethod
was preferred over a using directive, since several of the class names clash between either implementation so this would introduce an ambiguity.
有了上面的内容,我们就可以成功调用 tcm.exe
来导入这些测试:
With the above in place, we were then able to successfully call tcm.exe
to import these tests:
tcm testcase /import /collection:CollectionURL /teamproject:project /storage:path
这篇关于NUnit 与 Microsoft 测试管理器的集成的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!