【发布时间】:2009-12-29 17:08:42
【问题描述】:
我正在使用 NUnit 2.5 和 NAnt 0.85 来编译 .NET 3.5 库。因为 NAnt 0.85 不支持开箱即用的 .NET 3.5,所以我在 NAnt.exe.config 中添加了 3.5 框架的条目。
'MyLibrary' 构建,但是当我点击“测试”目标来执行 NUnit 测试时,它们似乎都没有运行。
[nunit2] Tests run: 0, Failures: 0, Not run: 0, Time: 0.012 seconds
以下是我的 NAnt.build 文件中用于构建和运行测试的条目:
<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 GUI 中运行良好。
测试 dll 肯定被找到了,因为如果我移动它,我会得到以下错误:
执行测试失败。如果您的程序集不是使用 NUnit 2.2.8.0 构建的... 无法加载文件或程序集“测试”或其依赖项之一...
如果有人能指出正确的方向或描述他们遇到的类似情况,我将不胜感激。
编辑我已经用 NAnt 0.86 beta 1 尝试过,同样的问题出现了。
【问题讨论】: