如何运行与恶性0.86测试版的NUnit v2.4.8测试? [英] How to run NUnit v2.4.8 tests with NAnt 0.86 beta?

查看:111
本文介绍了如何运行与恶性0.86测试版的NUnit v2.4.8测试?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我最近尝试使用楠(测试版0.86.2962.0)运行与NUnit的(v2.4.8)中没有任何成功的最新稳定版本编译的一些单元测试。

I tried recently to use NAnt (beta 0.86.2962.0) to run some unit tests compiled with the last stable version of NUnit (v2.4.8) without any success.

我得到的错误是:

[nunit2]大会的C:\开发\ MYSAMPLE \ BIN \测试\ My.Sample.Tests.dll。不包含任何测试

[nunit2] Assembly "C:\Dev\MySample\bin\tests\My.Sample.Tests.dll" contains no tests.

当然,大会包含了我可以从任何亚军运行,像NUnit的之一,TestDriven或ReSharper的测试。我想使用< nunit2>的任务,并没有直接的< EXEC>之一,但我不知道,如果它仍然是可能的,即使使用的app.config文件绑定组件版本

Of course, the assembly contains tests that I can run from any runner, like NUnit one, TestDriven or Resharper. I would like to use <nunit2> task, and not directly the <exec> one, but I'm wondering if it is still possible, even using app.config files to bind assembly versions.

推荐答案

我不记得为什么,但我放弃了使用&lt; nunit2>的任务,我一直在使用&lt; EXEC>任务和NUnit -console.exe得很开心。如果有帮助,这是我运行的NUnit和FxCop的测试目标。需要注意的是它跳过他们是否可执行不在Windows路径

I can't remember why, but I gave up on using the <nunit2> task and I've been using the <exec> task and nunit-console.exe happily. If it helps, here's my test target that runs NUnit and FxCop. Note that it skips them if the executables aren't in the Windows path.

<target name="test" description="Run unit tests" depends="build">
  <property name="windows-path" value="${string::to-lower(environment::get-variable('PATH'))}"/>
  <property name="nunit-in-path"
      value="${string::contains(windows-path, 'nunit')}"/>
  <echo message="Tests skipped because no NUnit folder was found in the Windows path."
      unless="${nunit-in-path}"/>
  <exec program="nunit-console.exe" if="${nunit-in-path}">
      <arg file="../MyProject/MyProjectTest.nunit"/>
  </exec>
  <property name="fxcop-in-path"
      value="${string::contains(windows-path, 'fxcop')}"/>
  <echo message="FxCop skipped because no FxCop folder was found in the Windows path."
      unless="${fxcop-in-path}"/>
  <fxcop projectFile="../MyProject/MyProject.fxcop" directOutputToConsole="true" 
      failOnAnalysisError="true" if="${fxcop-in-path}"/>
</target>

这篇关于如何运行与恶性0.86测试版的NUnit v2.4.8测试?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆