2016-07-11 55 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