由 Cruisecontrol 计划运行时 MSTest 未执行
一些背景:我试图在我当前的项目(.Net 4.0 和 VS 2010)上实现 Cruisecontrol (2.8.4)、MSBuild 和 MSTest 的集成。我正在使用 MSBuild 构建我的解决方案,并将 MSTest 作为 AfterBuild 目标添加到我的 .csproj 文件中以运行我的单元测试:
<Target Name="AfterBuild" DependsOnTargets="GetTestAssemblies" >
<Message Text="Normal Test" />
<Exec Command="del $(MSTestResultsFile)" ContinueOnError="true" />
<Exec WorkingDirectory="$(WorkingDir)" Command="MsTest @(TestAssemblies->'%(TestContainerPrefix)%(FullPath)',' ') /noisolation /resultsfile:$(MSTestResultsFile)" />
<Message Text="Normal Test Done" />
我已将 Cruisecontrol.config 配置为使用 MSBuild,即:
<schedule interval="300">
<exec command="cmd.exe"
workingdir="C:\CruiseControl\projects\Framework"
args="msbuild Solution.sln" />
</schedule>
当我从命令提示符运行构建时,即: cmd.exe:
msbuild <projectname>.sln
,解决方案和项目正确构建,单元测试运行并将结果输出到 / resultsfile:$(MSTestResultsFile)
指定。
我的问题是,当执行 CruiseControl 计划中的命令时,构建 (MSBuild) 实际上成功,但我的 MSTest: /resultsfile:$(MSTestResultsFile)
为空。似乎单元测试根本没有运行。
我不知道为什么会发生这种情况? 任何帮助将不胜感激!
Some background: Im trying to implement the integration of Cruisecontrol (2.8.4), MSBuild and MSTest on my current project (.Net 4.0 and VS 2010). I'm using MSBuild to build my solution and added a MSTest as AfterBuild Target into my .csproj files to run my unit tests:
<Target Name="AfterBuild" DependsOnTargets="GetTestAssemblies" >
<Message Text="Normal Test" />
<Exec Command="del $(MSTestResultsFile)" ContinueOnError="true" />
<Exec WorkingDirectory="$(WorkingDir)" Command="MsTest @(TestAssemblies->'%(TestContainerPrefix)%(FullPath)',' ') /noisolation /resultsfile:$(MSTestResultsFile)" />
<Message Text="Normal Test Done" />
I've configured cruisecontrol.config to use MSBuild, ie:
<schedule interval="300">
<exec command="cmd.exe"
workingdir="C:\CruiseControl\projects\Framework"
args="msbuild Solution.sln" />
</schedule>
When I run the build from the command prompt ie: cmd.exe:
msbuild <projectname>.sln
, the solution and projects builds correctly, the unit tests runs and outputs the results to the /resultsfile:$(MSTestResultsFile)
specified.
My problem is when the command in the cruisecontrol schedule is executed, the build (MSBuild) actually succeededs but my MSTest: /resultsfile:$(MSTestResultsFile)
is empty. It seems that the unit tests wasn't run at all.
I have no clue why this is happening?
Any help would be appreciated!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
通过更改 Cruisecontrol 计划配置以使用 msbuild.exe 而不是 cmd.exe 导致执行单元测试
By change the cruisecontrol schedule config to use the msbuild.exe in stead of cmd.exe resulted in the unit tests being executed