问题描述
我使用NUnit的2.5和0.85楠编译一个.NET 3.5库。由于恶性0.85不支持.NET 3.5开箱,我增加了3.5框架NAnt.exe.config条目。
I'm using NUnit 2.5 and NAnt 0.85 to compile a .NET 3.5 library. Because NAnt 0.85 doesn't support .NET 3.5 out of the box, I've added an entry for the 3.5 framework to NAnt.exe.config.
MyLibrary的建立,但是当我点击测试的目标来执行NUnit的测试,他们都不来运行。
'MyLibrary' builds, but when I hit the "test" target to execute the NUnit tests, none of them seem to run.
[nunit2] Tests run: 0, Failures: 0, Not run: 0, Time: 0.012 seconds
下面是我为建筑NAnt.build文件中的条目,并运行测试:
Here are the entries in my NAnt.build file for the building and running the tests:
<target name="build_tests" depends="build_core">
<mkdir dir="Target" />
<csc target="library" output="Target\Test.dll" debug="true">
<references>
<include name="Target\MyLibrary.dll"/>
<include name="Libraries\nunit.framework.dll"/>
</references>
<sources>
<include name="Test\**\*.cs" />
</sources>
</csc>
</target>
<target name="test" depends="build_tests">
<nunit2>
<formatter type="Plain" />
<test assemblyname="Target\Test.dll" />
</nunit2>
</target>
有一些版本的问题,我需要知道的? Test.dll的正常运行,在NUnit的图形用户界面。
Is there some versioning issue I need to be aware of? Test.dll runs fine in the NUnit GUI.
测试DLL肯定是被人发现,因为如果我移动它,我得到了以下错误:
The testing dll is definitely being found, because if I move it I get the following error:
失效执行测试(多个)。如果组件未建立使用NUnit 2.2.8.0 ... 无法加载文件或程序集测试或它的某一个依赖...
我将不胜感激,如果任何人都可以点我在正确的方向或描述他们遇到了类似地情况。
I would be grateful if anyone could point me in the right direction or describe a similary situation they have encountered.
修改我曾经试图用南特0.86 Beta 1中,并且出现了同样的问题。
Edit I have since tried it with NAnt 0.86 beta 1, and the same problem occurs.
推荐答案
在Nunit2南特任务仍然很难codeD使用NUnit的2.2库。
The Nunit2 Nant task is still hardcoded to use the Nunit 2.2 library.
请参阅文档:http://nant.sourceforge.net/release/latest/help/tasks/nunit2.html
使用NUnit的V2.2框架运行测试
您可能能够排序了这一点与程序集绑定重定向,但我认为该建议仅仅是使用南特&LT; EXEC&GT;任务,并直接调用NUnit的2.5控制台亚军。
You may be able to sort this out with assembly binding redirection, however I think the recommendation is just to use the Nant <exec> task and call the NUnit 2.5 console runner directly.
例如:
<!-- Run Unit Tests under NUnit 2.5 -->
<exec program="${LibraryPath}\NUnit\2.5.7\nunit-console.exe">
<arg value="${SourcePath}\ProjectName.Tests\bin\Release\ProjectName.Tests.dll" />
</exec>
简单多了呢。
Much simpler anyway.
我通过TeamCity的运行这和单元测试输出似乎仍然无法正常运行。
I am running this through TeamCity and the unit test output seems to still behave correctly.
这篇关于恶性不运行NUnit的测试的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!