的MSBuild运行单元测试

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

我想配置CruiseControl的.NET周期性地建设我们的资料库code和运行包含在解决方案中的测试。我已经配置从SVN服务器和建筑部分检索code。但我无法在其上运行的测试。 MSBuild的不断抱怨说。

I am trying to configure CruiseControl to build our repository code periodically and run the tests included in the solution. I have configured the retrieving code from the svn server and building part. But I am unable to run tests on it. MSBuild keeps on complaining that.

错误MSB4057:目标测试呢  在项目中不存在

error MSB4057: The target "Test" does not exist in the project.

我也尝试通过运行命令行测试,看看是否具有相同的错误工作。我用:MSBuild.exe TestProject.csproj /吨:测试

I also tried running the tests through command line to see if that works with the same error. I used: MSBuild.exe TestProject.csproj /t:Test

我的配置是这样的:

<tasks> <msbuild> <executable>C:\WINDOWS\Microsoft.NET\Framework\v4.0.30319\MSBuild.exe</executable> <workingDirectory>C:\WorkingDir\build\MainProject</workingDirectory> <projectFile>MainProject.csproj</projectFile> <buildArgs>/noconsolelogger /p:Configuration=Debug /v:diag</buildArgs> <targets>Build</targets> <timeout>900</timeout> <logger>C:\Program Files (x86)\CruiseControl.NET\server\ThoughtWorks.CruiseControl.MSBuild.dll</logger> </msbuild> <msbuild> <executable>C:\WINDOWS\Microsoft.NET\Framework\v4.0.30319\MSBuild.exe</executable> <workingDirectory>C:\WorkingDir\build\TestProject</workingDirectory> <projectFile>TestProject.csproj</projectFile> <buildArgs>/noconsolelogger /p:Configuration=Debug /v:diag</buildArgs> <targets>Test</targets> <timeout>900</timeout> <logger>C:\Program Files (x86)\CruiseControl.NET\server\ThoughtWorks.CruiseControl.MSBuild.dll</logger> </msbuild> </tasks>

我想AP preciate在正确的方向的蛛丝马迹。

I would appreciate any hint in the right direction.

推荐答案

您还没有解释你所使用的测试框架,这是pretty关键在这里。

You havent explained what test framework you're using, which is pretty key here.

有关MSTest的,这个调用东西是TFS [作为亚军的东西部分是Visual Studio中,这就是为什么一个任务运行MSTest的不能MSBuild的,这是.NET Framework的一部分的一部分的一部分 - 这也是为什么MSTest的力量[在2010年的一个子集]要安装Visual Studio您的构建服务器上(也有在这里关于该主题的好几个问题)]

For MSTest, this invocation stuff is part of TFS [as the runner stuff is part of Visual Studio, which is why a Task to run MSTest can not be part of MSBuild, which is part of the .NET Framework -- this is also why MSTest forces [in 2010, a subset of] Visual Studio to be installed on your build server (there are a good few questions around here on that topic)]

的对于xUnit,人们做这样的东西

有关的NUnit有可以提供文件列表以一个任务。

For NUnit there's a task that you can supply a list of files to.

底线 - 自动加入一个测试自定义目标触发显着的MSBuild包装任务调用测试运行一个文件的.csproj

Bottom line - one adds a Test custom target to a .csproj file which triggers the salient MSBuild wrapper task for invoking your test runner.

更多推荐

的MSBuild运行单元测试

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

发布评论

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

>www.elefans.com

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