Good Morning to all.
I am faily new to CCNET and MSTests. I am facing some issue with this and any help/suggesion would be of great help. I tried to integrate MsTest and cruise control as described in many posts found on the net. But I am not able to see unit tests output in cruise control dashboard. though when I open the .trx file , I am able to see the message outut as (Debug trac or console output) but not in Dashboard. I am using Visual Studio 2008 professional version. I have taken the latest MsTestSummary.xsl file as well. I am clueless about the problem here. Following I have doneto integrate.
ccnet.config file<tasks>
<exec><executable>D:\Program Files\Microsoft Visual Studio 9.0\Common7\IDE\MSTest.exe</executable>
<baseDirectory>D:\p4\Tools</baseDirectory><buildArgs>/testcontainer:\p4\Tools\Tests\Tools.Tests\bin\Debug\Tools.Tests.dll /resultsfile:\CCNet\Logs\VisualStudioTest\TestResult_New.trx</buildArgs>
<buildTimeoutSeconds>600</buildTimeoutSeconds></exec>
</tasks><publishers>
<merge><files>
<file>D:\Program Files\CruiseControl.NET\server\FrameworkAutomationProject\Artifacts\buildlogs*.xml</file><file>D:\CCNet\Logs\VisualStudioTest\TestResult_New.trx</file><!--<file>D:\CCNet\Logs\DeploySQL\CCNetDeploy_BUSINESS.xml</file>
<file>D:\CCNet\Logs\DeploySQL\CCNetDeploy_TRM.xml</file>
<file>D:\CCNet\Logs\DeploySQL\CCNetDeploy_FRAMEWORK.xml</file>--></files> </merge>
<xmllogger />
Dashboard.config file<buildReportBuildPlugin>
<xslFileNames><xslFile>xsl\header.xsl</xslFile>
<xslFile>xsl\modifications.xsl</xslFile><xslFile>xsl\compile.xsl</xslFile> <xslFile>xsl\MsTestSummary.xsl</xslFile> </xslFileNames>
</buildReportBuildPlugin>I would appreciate if you could help me out to resolve this issue. Please feel free to ask me for more ifnormation.
Thanks,
Ambuj
ambuj.tayal@fiserv.co.in
The problem is with the XSLT transforms because Microsoft altered the result file format.
I have modified XSLT files at http://blogs.blackmarble.co.uk/files/folders/samples/entry11115.aspx
or have a look at http://blogs.blackmarble.co.uk/blogs/rfennell/archive/2008/03/11/cruisecontrol-amp-mstest-from-visual-studio-2008.aspx
I am also working with VS 2008's MsTest. Using the updated XSL files that you posted, I am able to display test failures from teh TRX files on the web dashboard. But I am not able to extract test counts into a StatisticsPublisher. My ccnet.config has this:
<statistics>
<statisticList>
<statistic name='TestFailures2' xpath='sum(//cruisecontrol/build/TestRun/ResultSummary/Counters/@failed)' />
<statistic name='TestIgnored2' xpath='sum(//cruisecontrol/build/TestRun/ResultSummary/Counters/@inconclusive)'/>
<statistic name='TestsPassed2' xpath='sum(//cruisecontrol/build/TestRun/ResultSummary/Counters/@passed)' />
<statistic name='TestCount2' xpath='sum(//cruisecontrol/build/TestRun/ResultSummary/Counters/@total)' />
</statisticList>
</statistics>
I think the problem is that the output from MsTest 9.0 includes an XML namespace as you can see here:<TestRun id="63bf026c-914e-4c18-9dae-f2ae9df186ec" name="rgrossko@RGROSSKO-DESK1 2008-10-16 13:37:32" runUser="amr\rgrossko" xmlns="http://microsoft.com/schemas/VisualStudio/TeamTest/2006">The xmlns attribute breaks the XPath in my statistics publisher.
Do you have a suggestion for dealing with this ?
Thanks.
Rainer.
To answer my own question of Oct-16 2008:
I can work around the xml namespace issue by simplifying the XPath like this:
<statistics>
<statisticList>
<statistic name='TestFailures' xpath='sum(//@failed)' />
<statistic name='TestIgnored' xpath='sum(//@inconclusive)'/>
<statistic name='TestCount' xpath='sum(//@total)' />
</statisticList>
</statistics>
Now I can see the pass/fail statistics in the statistics graphs.
You can use the local-name() and namespace-uri() xpath functions to correct your statistic xpaths as follows:
<statistic name="TestFailures" xpath="sum(/cruisecontrol/build//*[local-name()='Counters'][namespace-uri()='http://microsoft.com/schemas/VisualStudio/TeamTest/2006']/@failed)" />I had to do the same thing to pick up my gallio statistics and it works like a charm.