2012-06-18 48 views
0

我嘗試在jenkins作業中使用nunit時遇到了一些問題。儘管nunit-2.6 [1]的文檔指出,您可以指定用於測試的構建配置,但這似乎不起作用。我嘗試運行的「釋放」配置測試,但是NUnit的嘗試加載調試組裝和失敗:(我先從以下調用NUnit的:Nunit忽略配置中的命令行參數

nunit-console-x86.exe ambiHomeWPFTest\Tests\Tests.csproj /config:Release 

任何人有一個想法,到底是怎麼回事有?我是很新的.NET從Java背景的,所以也許我錯過了一些東西簡單。

[1] http://www.nunit.org/index.php?p=consoleCommandLine&r=2.6

[test_ambiHomeWPFTest_master] $ cmd /c call  C:\Windows\TEMP\hudson8704126216198591607.bat 

c:\jenkins\workspace\test_ambiHomeWPFTest_master>nunit-console-x86.exe ambiHomeWPFTest\Tests\Tests.csproj /config:Release 
NUnit-Console version 2.6.0.12051 
Copyright (C) 2002-20011 Charlie Poole. 
Copyright (C) 2002-2004 James W. Newkirk, Michael C. Two, Alexei A. Vorontsov. 
Copyright (C) 2000-2002 Philip Craig. 
All Rights Reserved. 

Runtime Environment - 
    OS Version: Microsoft Windows NT 6.1.7601 Service Pack 1 
    CLR Version: 2.0.50727.5456 (Net 3.5) 

ProcessModel: Default DomainUsage: Default 
Execution Runtime: net-3.5 
Unhandled Exception: 
System.IO.DirectoryNotFoundException: Ein Teil des Pfades  "c:\jenkins\workspace\test_ambiHomeWPFTest_master\ambiHomeWPFTest\Tests\bin\Debug\Tests.dll " konnte nicht gefunden werden. 
    bei System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath) 
    bei System.IO.FileStream.Init(String path, FileMode mode, FileAccess access, Int32  rights, Boolean useRights, FileShare share, Int32 bufferSize, FileOptions options,  SECURITY_ATTRIBUTES secAttrs, String msgPath, Boolean bFromProxy) 
    bei System.IO.FileStream..ctor(String path, FileMode mode, FileAccess access) 
    bei NUnit.Core.AssemblyReader.CalcHeaderOffsets() 
    bei NUnit.Core.AssemblyReader..ctor(String assemblyPath) 
    bei NUnit.Util.RuntimeFrameworkSelector.SelectRuntimeFramework(TestPackage package) 
    bei NUnit.Util.DefaultTestRunnerFactory.GetTargetProcessModel(TestPackage package) 
    bei NUnit.Util.DefaultTestRunnerFactory.MakeTestRunner(TestPackage package) 
    bei NUnit.ConsoleRunner.ConsoleUi.Execute(ConsoleOptions options) 
    bei NUnit.ConsoleRunner.Runner.Main(String[] args) 

c:\jenkins\workspace\test_ambiHomeWPFTest_master>exit -100 
Build step 'Execute Windows batch command' marked build as failure 
Finished: FAILURE 
+0

奇怪嗎?我只是檢查了一下,在使用NUnit 2.6的'/ config:Release'開關時我沒有問題。您確實在相應的版本路徑中有該版本的DLL的發佈版本? –

+0

我很確定。 這是包含Tests項目的解決方案。 http://pastebin.com/jeMBXSbq 編譯前期工程http://pastebin.com/UZfb1wLa 和Tests.dll位於Tests/bin/Release – cemonds

+0

內如果您對測試程序集進行了Debug版本化,會發生什麼情況? –

回答

1

如果您在引用了.csproj時遇到的問題與/config:開關爲例e nunit-console-x86命令,我的建議是,您明確引用感興趣的DLL而不是。

在上述情況下,呼叫因此應該是:

nunit-console-x86 ambiHomeWPFTest\Tests\bin\Release\Tests.dll 
+0

謝謝,現在就這樣做了,儘管它看起來更像是一種工作。 – cemonds