Getting MSTest output to show in CruiseControl.Net

北城以北 提交于 2019-12-04 08:12:47

问题


I currently have our build server set up with CruiseControl.Net running a build using MSBuild and then running unit tests using MSTest. The problem is I can't see the output of the unit tests in CC - I know they are being run because I can get the build to fail if I commit a failing test.

I have followed the online guides from http://blogs.blackmarble.co.uk/blogs/bm-bloggers/archive/2006/06/14/5255.aspx and http://www.softwarepassion.com/?p=89 but still having no luck.

My ccnet.config file contains

    <tasks>
         <msbuild>
              <executable>C:\WINDOWS\Microsoft.NET\Framework\v3.5\MSBuild.exe</executable>
              <workingDirectory>C:\CCBuilds</workingDirectory>
              <projectFile>Application.sln</projectFile>
              <buildArgs>/noconsolelogger /p:Configuration=Debug /v:diag</buildArgs>
              <targets>Build</targets>
              <timeout>900</timeout>
              <logger>C:\Program Files\CruiseControl.NET\server\ThoughtWorks.CruiseControl.MsBuild.dll</logger>
        </msbuild>  

        <exec>
            <executable>deleteTestLog.bat</executable>
            <baseDirectory>C:\CCBuilds</baseDirectory>
            <buildArgs></buildArgs>
            <buildTimeoutSeconds>30</buildTimeoutSeconds>
        </exec>

        <exec>
            <executable>C:\Program Files\Microsoft Visual Studio 9.0\Common7\IDE\mstest.exe</executable>
            <baseDirectory>C:\CCBuilds</baseDirectory>
            <buildArgs>/testcontainer:UnitTests\bin\Debug\UnitTests.dll /runconfig:localtestrun.Testrunconfig /resultsfile:testResults.trx</buildArgs>
            <buildTimeoutSeconds>30</buildTimeoutSeconds>
        </exec>

    </tasks>

    <publishers>
        <merge>
            <files>
                <file>testResults.trx</file>
            </files>
        </merge>

        <xmllogger logDir="C:\Program Files\CruiseControl.NET\server\Checkin Build\Artifacts\buildlogs" />

    </publishers> 

The log file in C:\Program Files\CruiseControl.NET\server\Checkin Build\Artifacts\buildlogs contains the unit test results, have I missed any steps?


回答1:


i made the following changes to get MSTest results output to be shown in CruiseControl.NET

1) For Dashboard - in dashboard.config added a reference to the Mstest 2008 xsl file under buildReportBuildPlugin

<xslFile>xsl\MsTestReport2008.xsl</xslFile>

2) For email - in ccservice.exe.config added the reference to the same xsl file under xslFiles section

<file name="xsl\MsTestSummary2008.xsl"/>



回答2:


Did you configure your web dashboard with the correct xsl to format the outputs? There are two different versions of the XSL's (Summary and Report) for VSTS 2005 and 2008 as Microsoft changed the XML output drastically between the two versions. The changes were very good, just breaking changes.




回答3:


For the Dashboard, I think you need to add the MSTest Summary in the xlsFiles, but add the MSTest Report build report plugin. That is,

  <buildReportBuildPlugin>
    <xslFileNames>
      <xslFile>xsl\MsTestSummary2008.xsl</xslFile>
    </xslFileNames>
  </buildReportBuildPlugin>
  <xslReportBuildPlugin description="MSTest Report" actionName="MSTESTReport" xslFileName="xsl\MsTestReport2008.xsl" />
</buildPlugins>

I tried adding MSTestReport on both but it didn't work, but the setting above did. Hope that helps...



来源:https://stackoverflow.com/questions/1209972/getting-mstest-output-to-show-in-cruisecontrol-net

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!