MSTest and CruiseControl .NET
I have been trying to get Visual Studio 2005 Team Developer style unit tests working within CruiseControl.
The documention says it should work, but is a little scant as to the detail of how to do it. So now I have it all going I thought an example of the working ccnet.config file with some comments might help other people trying to get this going.
So the background is I have a VS.NET 2005 solution (My Sample.sln) with some projects in it. One of these is a Test Project (TestProject.csproj). This contains some test which can be run via the Test menu option is VS.NET.
CCNET.CONFIG
<project name="My Sample">
<workingDirectory>C:projectsMy Sample</workingDirectory>
<tasks>
<devenv>
<solutionfile>"C:projectsMy SampleMy Sample.sln"</solutionfile>
<configuration>Debug</configuration>
<buildtype>Build</buildtype>
<executable>"C:Program FilesMicrosoft Visual Studio 8Common7IDEdevenv.com"</executable>
<buildTimeoutSeconds>90</buildTimeoutSeconds>
</devenv>
<exec>
<executable>deleteTestLog.bat</executable>
<baseDirectory>C:projectsMy Sample</baseDirectory>
<buildArgs></buildArgs>
<buildTimeoutSeconds>30</buildTimeoutSeconds>
</exec>
<exec>
<executable>C:Program FilesMicrosoft Visual Studio 8Common7IDEmstest.exe</executable>
<baseDirectory>C:projectsMy Sample</baseDirectory>
<buildArgs>/testcontainer:testprojectbindebugtestproject.dll /runconfig:localtestrun.Testrunconfig /resultsfile:testResults.trx</buildArgs>
<buildTimeoutSeconds>30</buildTimeoutSeconds>
</exec>
</tasks>
<publishers>
<merge>
<files>
<file>testResults.trx</file>
</files>
</merge>
</publishers>
</project>
</cruisecontrol>
DASHBOARD.CONFIG
By default with CCNET build 1277 has the entry to display MSTest results in the summary. If you want the results on a separate menu item (like nUnit or FxCop) then the dashboard.config should contain the following bits
<buildPlugins>
<buildReportBuildPlugin>
<xslFileNames>
<xslFile>xslheader.xsl</xslFile>
<xslFile>xslmodifications.xsl</xslFile>
<xslFile>xslcompile.xsl</xslFile>
<xslFile>xslunittests.xsl</xslFile>
<xslFile>xslMsTestSummary.xsl</xslFile>
<xslFile>xslfxcop-summary.xsl</xslFile>
<xslFile>xslNCoverSummary.xsl</xslFile>
<xslFile>xslSimianSummary.xsl</xslFile>
</xslFileNames>
</buildReportBuildPlugin>