由 Cruisecontrol 计划运行时 MSTest 未执行

发布于 2024-09-25 16:04:42 字数 1211 浏览 0 评论 0原文

一些背景:我试图在我当前的项目(.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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

最好是你 2024-10-02 16:04:42

通过更改 Cruisecontrol 计划配置以使用 msbuild.exe 而不是 cmd.exe 导致执行单元测试

<schedule interval="300">
    <exec command="msbuild.exe"
                    workingdir="C:\Windows\Microsoft.NET\Framework\v4.0.30319"
                    args="C:\CruiseControl\projects\DTSFramework\DTS.Solution.sln" />
</schedule>

By change the cruisecontrol schedule config to use the msbuild.exe in stead of cmd.exe resulted in the unit tests being executed

<schedule interval="300">
    <exec command="msbuild.exe"
                    workingdir="C:\Windows\Microsoft.NET\Framework\v4.0.30319"
                    args="C:\CruiseControl\projects\DTSFramework\DTS.Solution.sln" />
</schedule>
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文