2015-11-19 127 views
0

我已经找到了这个答案,并关闭了几天,所以如果我错过了答案,我很抱歉。使用命令行寻找测试MStest

我有一个MS测试,我想从命令行运行(最终在詹金斯)。我有MSTest.exe和\ testcontainer设置,但无法获得我想要运行的实际测试的语法。

我的解决方案IntegrationTest有两个项目(使用Page模型设计模式),IntegrationTest和测试。 FYI \ testcontainer指向IntegrationTest中的程序集(dll)

我想运行的测试是在Tests/UnitTest1/Login_To_system中。 我曾尝试:

/test:Tests.UnitTest1.Login_To_system 
/test:Tests/UnitTest1/Login_To_system 

以及各种与结果组合“无法找到”

没有为测试没有元数据文件 - 使用社区2015年

整条生产线,直到测试的尝试之一是:

"C:\Program Files (x86)\Microsoft Visual Studio 14.0\Common7\IDE\mstest.exe" /resultsfile:"C:\public\data\trunk\AutomatedTesting\IntegrationTest\TestResults\Results.trx" /testcontainer:"C:\public\data\trunk\AutomatedTesting\IntegrationTest\IntegrationTest\bin\Debug\IntegrationTest.dll" /test:Tests.UnitTest1.Login_To_system 

任何帮助,将不胜感激

。 210

回答

0

这对我有用。

using Microsoft.VisualStudio.TestTools.UnitTesting; 

namespace FooTest 
{ 
    [TestClass] 
    public class One 
    { 
     [TestMethod] 
     public void TestMethod1() 
     { 
      ; 
     } 
    } 
} 

FOM命令行:

C:\ TMP \ FooTest \ FooTest \ BIN \推出>MSTEST /testcontainer:"./FooTest.dll “/测试:” FooTest。一。” Microsoft(R)Test 执行命令行工具版本14.0.23107.0版权所有(c) Microsoft Corporation。版权所有。

加载./FooTest.dll ...开始执行......

结果的顶部级测试 ------- --------传递FooTest.One.TestMethod1 1/1 test(s)Passed

Summary ------- Test Run Completed。通过1个---------共1个 测试设置:默认测试设置

所以它是 “AssemblyName.ClassName.MethodName” 来标识一个测试,在/测试 https://msdn.microsoft.com/en-us/library/ms182489.aspx