开发者

MSTest not being executed when run by Cruisecontrol schedule

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 /results开发者_StackOverflowfile:$(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!


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>
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜