2011-12-05 46 views
21

我想弄清楚如何讓TeamCity運行我的MSTests。我已經安裝使用下面的參數構建步驟:如何讓TeamCity使用MSTest運行測試?

  • 路徑MSTest.exe:%system.MSTest.10.0%
  • 表的彙編文件:項目\ Metadude。 .Tests \ bin \ Debug \ Metadude。 .Test.dll
  • MSTest的運行配置文件: Local.testsettings

然而,當這一步運行時,它不執行任何測試。這是從日誌輸出:

[02:13:49]: Step 2/2: Run Unit Tests (MSTest) 
[02:13:49]: [Step 2/2] Starting: "D:\Program Files (x86)\TeamCity\buildAgent\plugins\dotnetPlugin\bin\JetBrains.BuildServer.NUnitLauncher.exe" #TeamCityImplicit 
[02:13:49]: [Step 2/2] in directory: D:\Program Files (x86)\TeamCity\buildAgent\work\1f82da3df0f560b6 
[02:13:50]: [Step 2/2] Microsoft (R) Test Execution Command Line Tool Version 10.0.30319.1 
[02:13:50]: [Step 2/2] Copyright (c) Microsoft Corporation. All rights reserved. 
[02:13:50]: [Step 2/2] 
[02:13:50]: [Step 2/2] Please specify tests to run, or specify the /publish switch to publish results. 
[02:13:50]: [Step 2/2] For switch syntax, type "MSTest /help" 
[02:13:50]: [Step 2/2] Process exited with code 1 
[02:13:50]: Publishing internal artifacts 
[02:13:50]: [Publishing internal artifacts] Sending build.finish.properties.gz file 
[02:13:50]: Build finished 

我試圖指定測試使用以下命令來運行:

  • 測試: Tests.Metadude.Core.Extensions.StringExtensionsTests

但這並不奏效。我似乎無法在TeamCity中找到與MSTest構建步驟有關的任何文檔。

UPDATE 好吧,我是個白癡。那麼這可能有點苛刻,但測試程序集從程序集名稱中缺少「s」。儘管如此,在構建日誌中獲得某些效果會很好。

+0

@Leslie的答案的步驟漢克斯哪些解決您的問題(就像使用他們的變量時,沒有工作) ? – wal

+0

@wal嗯,我的名字中有一個拼寫錯誤。 –

+0

我也是一個從程序集名稱中錯過了「s」的白癡。這是值得三重檢查:) – TinyRacoon

回答

20

首先,確保您試圖測試的組件存在於該位置。

您的相對路徑: 項目\ Metadude..Tests \ BIN \調試\ Metadude..Test.dll

但是我希望通過東西記錄TC如果你的文件didnt存在。它看起來像它的運行MSTest沒有任何爭論。

如果您確定路徑正確,請在不指定.testsettings文件的情況下嘗試查看會發生什麼情況。我沒有這個在TC中成功使用MSTest(但你可能需要它)。我在做不同的另一件事是我指定的完整路徑MSTest.exe,即

C:\ Program Files文件\微軟的Visual Studio 10.0 \ Common7 \ IDE \ MSTest.exe

代替其可變'%system.MSTest.10.0%'

我不記得我爲什麼這樣做,但也將是一個很好的理由

+0

_首先,確保您試圖測試的程序集存在於該位置。_ 與@wal一樣,它是彙集我的名字。在我的情況下,程序集名稱與項目名稱不同......假設。順便說一句:沒有別的東西被TC/MSTest記錄。 – Campey

+0

謝謝沃爾,做到了! – DevDave

+6

由於Visual Studio 2012(至少是快速版本)MsTest.exe被稱爲'vstest.console.exe',可以在 'C:\ Program Files(x86)\ Microsoft Visual Studio 11.0 \ Common7 \ IDE \ CommonExtensions \ Microsoft \ TestWindow \ vstest.console.exe' – dwonisch

相關問題