请告诉我如何使用 msbuild 运行 nunit。我使用 TFS 进行代码集成和 VS2010 。
您可能希望将 NUnit 与 TFSBuild 而不是 MSBuild 集成,因为您使用的是 Team Foundation Server。
您将需要 MSBuild 任务才能运行 NUnit,如以下三个教程中所述:
- 将 NUnit 和 Ncover 与 TFS 构建结合使用 http://morten.lyhr.dk/2008/05/using-nunit-and-ncover-with-tfs-build.html
- 将 Nunit 测试集成到 Tfs 构建中 http://www.codewrecks.com/blog/index.php/2009/07/19/integrate-nunit-test-into-a-tfs-build/
- MSBuild 与 NUnit http://www.zorched.net/2006/11/28/msbuild-with-nunit/
The 最简单的方法是使用MSBuild 社区任务 http://msbuildtasks.tigris.org/你已经有一个NUnit
任务准备好使用,您只需将目标添加到您的 msbuild 文件中,如下所示:
<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>
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)