2015-11-19 114 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