2016-07-11 36 views
1

所以我有我的NUnit 3.2.1編譯測試的dll,我在另一個程序中使用命令「vstest.console.exe」運行如下:運行NUnit測試沒有nunit.framework.dll在同一個存儲庫

var Args = "/UseVsixExtensions:true" + " " + "\"" + @"D:\path\myDllTestNunit.dll" + "\"" + 
       " " + "/TestAdapterPath:" + "\"" + @"C:\path\NUnit3TestAdapter.3.0.10\lib" + "\"" + 
       " " + "/Logger:trx" + " /settings:" + "\"" + @"D:\pathRunsettings\dbci_2016_06_23_10_01_56.runsettings" + "\""; 
     var cmdPath = @"C:\Program Files (x86)\Microsoft Visual Studio 11.0\Common7\IDE\CommonExtensions\Microsoft\TestWindow\vstest.console.exe"; 

     var proc = new Process(); 
     proc.StartInfo.FileName = cmdPath; 
     proc.StartInfo.Arguments = Args; 

     proc.StartInfo.RedirectStandardOutput = true; 
     proc.StartInfo.RedirectStandardError = true; 
     proc.EnableRaisingEvents = true; 
     proc.StartInfo.CreateNoWindow = false; 

     proc.ErrorDataReceived += proc_DataReceived; 
     proc.OutputDataReceived += proc_DataReceived; 
     proc.StartInfo.UseShellExecute = false; 
     proc.Start(); 

     proc.BeginErrorReadLine(); 
     proc.BeginOutputReadLine(); 

     proc.WaitForExit(); 
     Console.ReadLine(); 

我的問題是,我想用這個命令,但沒有在同一目錄下有nunit.framework.dll中執行我的測試。我試圖把這個在GAC,但我還有以下錯誤(與NUnit的適配器已經嘗試過最後一個版本太多,仍然得到了相同):

>>> Starting test execution, please wait... 
>>> Information: NUnit Adapter 3.0.10.0: Test execution started 
>>> 
>>> Information: Running all tests in D:\appli\statro\RSS3_BATCHES_TEST\UT\LANCE 
MENT_TESTS\RSS3.Batches.Test.Nunit.Tests.dll 
>>> 
>>> Warning: Dependent Assembly nunit.framework of D:\appli\statro\RSS3_BATCHES_ 
TEST\UT\LANCEMENT_TESTS\RSS3.Batches.Test.Nunit.Tests.dll not found. Can be igno 
red if not a NUnit project. 
>>> 
>>> Information: NUnit Adapter 3.0.10.0: Test execution complete 
>>> 
>>> Warning: No test is available in D:\appli\statro\RSS3_BATCHES_TEST\UT\LANCEM 
ENT_TESTS\RSS3.Batches.Test.Nunit.Tests.dll. Make sure that installed test disco 
verers & executors, platform & framework version settings are appropriate and tr 
y again. 

所以,長話短說,就是有可能啓動我的dun的nunit測試,而不是在同一目錄中有nunit.framework.dll? 謝謝

+0

*爲什麼*你想這樣做?測試程序集預計能夠加載'nunit.framework.dll' ...就像這樣簡單。 –

+0

那麼我將不得不在多個目錄下啓動多個dll的測試命令,我不想在每個目錄中安裝nunit.Framework.dll以啓動這些測試。所以我想把它放在其他地方(試用GAC),但似乎參考找不到它。 – neow

+0

但你是如何建立這些測試組件?我期望構建過程自動包含測試程序集的所有依賴項 - 包括nunit.framework.dll。 –

回答

0

NUnit跑步者手動加載框架以支持多個版本的框架。例如,NUnit 2和3測試由內部完全不同的跑步者運行。我們還支持在一次測試中針對多個版本的框架運行測試。

NUnit也沒有提供將程序集放入GAC的安裝,因爲它不支持針對不同.NET目標的多個副本。因此,裝配加載代碼從未經過GAC測試,也不會。

GAC對於您的團隊中的開發人員來說也很困難,他們需要手動安裝NUnit的正確版本和目標,才能構建它們。他們還需要協調版本升級。

磁盤很便宜,使用NuGet並允許它按照預期進行依賴複製。我們都僱用解決業務問題,而不是對抗我們的構建工具;-)

+0

是的,當然能夠使用NuGet會很好,但是它仍然沒有被自制的工具所支持,這些工具可以編譯我的dll並將它們安裝到服務器上。所以我必須找到一些其他的方法,我實際上嘗試以本地複製的方式。 感謝您的回答 – neow