如何从VS2010使用msbuild运行nunit [英] How to run nunit with msbuild from VS2010

查看:122
本文介绍了如何从VS2010使用msbuild运行nunit的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

请告诉我如何使用msbuild运行nunit.我正在使用TFS进行代码集成和VS2010.

please tell me how to run nunit with msbuild. I am using TFS for code integration and VS2010 .

推荐答案

由于您正在使用Team Foundation Server,因此您可能希望将NUnit与TFSBuild而不是MSBuild集成.

You probably want to integrate NUnit with TFSBuild and not MSBuild since you are using Team Foundation Server.

您将需要MSBuild任务才能运行NUnit,如以下三个教程中所述:

You will need MSBuild tasks to be able to run NUnit as explained in the three following tutorials:

  • Using NUnit and NCover with TFS Build
  • Integrate Nunit test into a Tfs build
  • MSBuild with NUnit

最简单的方法是使用 MSBuild社区任务,您已经在其中执行了NUnit任务准备使用,您只需要将目标添加到您的msbuild文件中,如下所示:

The easiest way is to use the MSBuild Community Tasks where you already have a NUnit task ready to be used and you only will need to add a target to your msbuild file like so:

<Target Name="RunTests">  
    <!-- Run Unit tests -->  
    <CreateItem Include="$(OutDir)*.Tests.dll">  
      <Output TaskParameter="Include" ItemName="TestAssembly" />  
    </CreateItem>  
    <NUnit ToolPath="..\Tools\NUnit" DisableShadowCopy="true" Assemblies="@(TestAssembly)" />  
  </Target>

这篇关于如何从VS2010使用msbuild运行nunit的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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