我想建立一臺生成機器,並想從批處理腳本運行nunit(在幾個相對較大且動態的解決方案上)。我跑以下命令行如何在 bin Debug 中使nunit-console看起來像組件,而不是 bin x86 Debug?
"C:\Program Files (x86)\NUnit 2.6.1\bin\nunit-console-x86.exe" "C:\MySolutionPath\MySolution.sln"
"C:\Program Files (x86)\NUnit 2.6.1\bin\nunit-console.exe" "C:\MySolutionPath\MySolution.sln"
倆給一個System.IO.DirectoryNotFoundException:
NUnit-Console version 2.6.1.12217
Copyright (C) 2002-2012 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: Could not find a part of the path 'C:\MyProjectPath\bin\x86\Debug\MyAssembly.dll'.
at System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath)
at System.IO.FileStream.Init(String path, FileMode mode, FileAccess access, Int32 rights, Boolean
useRights, FileShare share, Int32 bufferSize, FileOptions options, SECURITY_ATTRIBUTES secAttrs, St
ring msgPath, Boolean bFromProxy)
at System.IO.FileStream..ctor(String path, FileMode mode, FileAccess access)
at NUnit.Core.AssemblyReader.CalcHeaderOffsets()
at NUnit.Core.AssemblyReader..ctor(String assemblyPath)
at NUnit.Util.RuntimeFrameworkSelector.SelectRuntimeFramework(TestPackage package)
at NUnit.Util.DefaultTestRunnerFactory.GetTargetProcessModel(TestPackage package)
at NUnit.Util.DefaultTestRunnerFactory.MakeTestRunner(TestPackage package)
at NUnit.ConsoleRunner.ConsoleUi.Execute(ConsoleOptions options)
at NUnit.ConsoleRunner.Runner.Main(String[] args)
對我來說,這看起來是找錯了文件夾:
C:\MyProjectPath\bin\x86\Debug\MyAssembly.dll
應be
C:\MyProjectPath\bin\Debug\MyAssembly.dll
有沒有辦法在NUnit中指定這個(或者如果必須在解決方案中)?
我不想這樣做。我有數百個。我希望它能動態地找到解決方案的項目,然後根據這個進行測試。 –
@AndréChristofferAndersen它看起來像對待一個解決方案文件,如項目文件。我不確定你想要做什麼是可能的。也許你可以使用[NUnit projects](http://www.nunit.org/index.php?p=projectEditor&r=2.2)。 –
這可能是我誤會了。我認爲我可以讓nunit-console.exe運行與解決方案文件關聯的所有單元測試。可能是因爲我的問題正在演變爲:「如何在一個命令行的解決方案中運行所有nunit測試」。 –