恶性不运行NUnit的测试

编程入门 行业动态 更新时间:2024-10-22 18:51:06
本文介绍了恶性不运行NUnit的测试的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

我使用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 ...   无法加载文件或程序集测试或它的某一个依赖...

Failure executing test(s). If you assembly is not build using NUnit 2.2.8.0... Could not load file or assembly 'Test' or one of its dependencies...

我将不胜感激,如果任何人都可以点我在正确的方向或描述他们遇到了类似地情况。

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.

请参阅文档:nant.sourceforge/release/latest/help/tasks/nunit2.html

使用NUnit的V2.2框架运行测试

"Runs tests using the NUnit V2.2 framework"

您可能能够排序了这一点与程序集绑定重定向,但我认为该建议仅仅是使用南特&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的测试

本文发布于:2023-11-17 07:21:02,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1609284.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:测试   NUnit

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!