我已经使用CruiseControl设置了一个集成版本,并根据ccnet.log文件将其合并到我的测试结果中,但是当我查看日志时,找不到任何迹象,并且构建页面上显示没有运行测试(即使已运行)...
这是CCNET.LOG的最后3行:
2013-01-29 08:02:51,325 [GEMS - Continuous Integration:INFO] Merging file 'E:\GEMS_Build\Integration\TestResults\GEMS.Shared.UnitTests.trx'
2013-01-29 08:02:51,325 [GEMS - Continuous Integration:INFO] Merging file 'E:\GEMS_Build\Integration\TestResults\GEMS.Web.UnitTests.trx'
2013-01-29 08:02:51,325 [GEMS - Continuous Integration:INFO] Integration complete: Success - 1/29/2013 8:02:46 AM
这些路径和文件名是正确的。我验证了另外,如果没有,则会出现错误(我知道,因为我最初输入的是目录名)。
这些文件似乎是完全有效的MSTest .trx文件,包含来自测试结果的信息。我正在运行VS.NET 2012,如果那很重要的话...
以下是其中一个文件的结果摘要:
<ResultSummary outcome="Completed">
<Counters total="24" executed="24" passed="24" error="0" failed="0" timeout="0" aborted="0" inconclusive="0" passedButRunAborted="0" notRunnable="0" notExecuted="0" disconnected="0" warning="0" completed="0" inProgress="0" pending="0" />
</ResultSummary>
但是,CruiseControl网页的构建结果显示:
Suites run: 0, Tests run: 0, Failures: 0, Not run: 0, Time: 0seconds
No Tests Run
This project doesn't have any tests
从最终MSBuild任务的日志中可以清楚地看到测试运行在日志中(请注意,这与我要合并的.trx文件不同。这只是CCNET捕获的控制台日志)。
<msbuild startTime="01/28/2013 16:31:36" elapsedTime="00:00:12" elapsedSeconds="132" success="true">
<project name="Coverage" file="E:\GEMS_Build\Integration\Coverage.xml" startTime="01/28/2013 16:31:37" elapsedTime="00:00:11" elapsedSeconds="131" success="true">
<target name="Coverage" startTime="01/28/2013 16:31:38" elapsedTime="00:00:10" elapsedSeconds="130" success="true">
<message level="high"><![CDATA[E:\OpenCover\OpenCover.Console.exe -register:user -target:"E:\Program Files (x86)\Microsoft Visual Studio 11.0\Common7\IDE\mstest.exe" -output:"E:\GEMS_Build\Integration_Artifacts\0.1.1.270\OpenCover\shared.coverage.xml" -targetargs:"/testcontainer:E:\GEMS_Build\Integration\src\GEMS.Shared\GEMS.Shared.UnitTests\bin\Debug\GEMS.Shared.UnitTests.dll /resultsfile:E:\GEMS_Build\Integration\TestResults\GEMS.Shared.UnitTests.trx" -filter:"+[GEMS.Shared]* -[GEMS.Shared]GEMS.Shared.PerformanceCounters* -[GEMS.Shared]GEMS.Shared.Cache.* " -mergebyhash]]></message>
<message level="high"><![CDATA[Microsoft (R) Test Execution Command Line Tool Version 11.0.50727.1]]></message>
<message level="high"><![CDATA[Copyright (c) Microsoft Corporation. All rights reserved.]]></message>
<message level="high"><![CDATA[ ]]></message>
<message level="high"><![CDATA[Loading E:\GEMS_Build\Integration\src\GEMS.Shared\GEMS.Shared.UnitTests\bin\Debug\GEMS.Shared.UnitTests.dll...]]></message>
<message level="high"><![CDATA[Starting execution...]]></message>
<message level="high" />
<message level="high"><![CDATA[Results Top Level Tests]]></message>
<message level="high"><![CDATA[------- ---------------]]></message>
<message level="high"><![CDATA[Passed GEMS.Shared.UnitTests.Data.FilterTests.ANDFilterTest]]></message>
<message level="high"><![CDATA[Passed GEMS.Shared.UnitTests.Data.FilterTests.BasicFilterTest]]></message>
<message level="high"><![CDATA[Passed GEMS.Shared.UnitTests.Data.FilterTests.ComplexFilterTranslationTest]]></message>
<message level="high"><![CDATA[Passed GEMS.Shared.UnitTests.Data.FilterTests.ComplexParameterDictionaryTest]]></message>
<message level="high"><![CDATA[Passed GEMS.Shared.UnitTests.Data.FilterTests.FilterEncodeDecodeTest]]></message>
<message level="high"><![CDATA[Passed GEMS.Shared.UnitTests.Data.FilterTests.FilterRolloverTest]]></message>
<message level="high"><![CDATA[Passed GEMS.Shared.UnitTests.Data.FilterTests.IsNullFilterTest]]></message>
<message level="high"><![CDATA[Passed GEMS.Shared.UnitTests.Data.FilterTests.ORFilterTest]]></message>
<message level="high"><![CDATA[Passed GEMS.Shared.UnitTests.Data.FilterTests.SimpleEncodedFilterTest]]></message>
<message level="high"><![CDATA[Passed GEMS.Shared.UnitTests.Data.FilterTests.ValidateComplexExpressionTest]]></message>
<message level="high"><![CDATA[Passed GEMS.Shared.UnitTests.Data.FilterTests.ValidateFieldsTest]]></message>
<message level="high"><![CDATA[Passed GEMS.Shared.UnitTests.Data.FilterTests.ValidateTranslateTest]]></message>
<message level="high"><![CDATA[Passed GEMS.Shared.UnitTests.Data.JsonTests.ComplexJsonObjectConversionTest]]></message>
<message level="high"><![CDATA[Passed GEMS.Shared.UnitTests.Date.DateTimeExtensionTests.GetDaysInMonthTests]]></message>
<message level="high"><![CDATA[Passed GEMS.Shared.UnitTests.Date.DateTimeExtensionTests.GetEndOfLastMonthTests]]></message>
<message level="high"><![CDATA[Passed GEMS.Shared.UnitTests.Date.DateTimeExtensionTests.GetEndOfLastYearTests]]></message>
<message level="high"><![CDATA[Passed GEMS.Shared.UnitTests.Date.DateTimeExtensionTests.GetEndOfMonthTests]]></message>
<message level="high"><![CDATA[Passed GEMS.Shared.UnitTests.Date.DateTimeExtensionTests.GetEndOfYearTests]]></message>
<message level="high"><![CDATA[Passed GEMS.Shared.UnitTests.Date.DateTimeExtensionTests.GetLastWeekOfMonthTest]]></message>
<message level="high"><![CDATA[Passed GEMS.Shared.UnitTests.Date.DateTimeExtensionTests.GetStartOfLastMonthTests]]></message>
<message level="high"><![CDATA[Passed GEMS.Shared.UnitTests.Date.DateTimeExtensionTests.GetStartOfLastYearTests]]></message>
<message level="high"><![CDATA[Passed GEMS.Shared.UnitTests.Date.DateTimeExtensionTests.GetStartOfMonthTests]]></message>
<message level="high"><![CDATA[Passed GEMS.Shared.UnitTests.Date.DateTimeExtensionTests.GetStartOfYearTests]]></message>
<message level="high"><![CDATA[Passed GEMS.Shared.UnitTests.Date.DateTimeExtensionTests.GetWeekOfMonthTest]]></message>
<message level="high"><![CDATA[Passed GEMS.Shared.UnitTests.Date.DateTimeExtensionTests.GetWeekOfYearTests]]></message>
<message level="high"><![CDATA[Passed GEMS.Shared.UnitTests.Date.DateTimeExtensionTests.MaxDateTest]]></message>
<message level="high"><![CDATA[Passed GEMS.Shared.UnitTests.Date.DateTimeExtensionTests.MinDateTest]]></message>
<message level="high"><![CDATA[Passed GEMS.Shared.UnitTests.Enums.EnumMapperTests.EnumMapperSimpleFail1Test]]></message>
<message level="high"><![CDATA[Passed GEMS.Shared.UnitTests.Enums.EnumMapperTests.EnumMapperSimpleFail2Test]]></message>
<message level="high"><![CDATA[Passed GEMS.Shared.UnitTests.Enums.EnumMapperTests.EnumMapperSimpleSuccessfultTest]]></message>
<message level="high"><![CDATA[Passed GEMS.Shared.UnitTests.Security.ActiveDirectoryHelperUnitTests.AuthenticateUserTest]]></message>
<message level="high"><![CDATA[Passed GEMS.Shared.UnitTests.Security.ActiveDirectoryHelperUnitTests.GetADUserInfoTests]]></message>
<message level="high"><![CDATA[Passed GEMS.Shared.UnitTests.Security.ActiveDirectoryHelperUnitTests.GetAllUsersTest]]></message>
<message level="high"><![CDATA[Passed GEMS.Shared.UnitTests.Security.ActiveDirectoryHelperUnitTests.IsInGroupTests]]></message>
<message level="high"><![CDATA[Passed GEMS.Shared.UnitTests.Tasks.AsyncHelperTests.NoParameter]]></message>
<message level="high"><![CDATA[Passed GEMS.Shared.UnitTests.Tasks.AsyncHelperTests.NoParameterWithCallback]]></message>
<message level="high"><![CDATA[Passed GEMS.Shared.UnitTests.Tasks.AsyncHelperTests.OneParameterNoCallback]]></message>
<message level="high"><![CDATA[Passed GEMS.Shared.UnitTests.Tasks.AsyncHelperTests.OneParameterWithCallback]]></message>
<message level="high"><![CDATA[Passed GEMS.Shared.UnitTests.Text.StringExtensionsTests.DeleteLinesTest]]></message>
<message level="high"><![CDATA[Passed GEMS.Shared.UnitTests.Text.StringExtensionsTests.IsNullOrEmptyTests]]></message>
<message level="high"><![CDATA[Passed GEMS.Shared.UnitTests.Text.StringExtensionsTests.TestPlurals]]></message>
<message level="high"><![CDATA[Passed GEMS.Shared.UnitTests.Text.StringExtensionsTests.ToDateTimeTests]]></message>
<message level="high"><![CDATA[Passed GEMS.Shared.UnitTests.Text.StringExtensionsTests.ToEnumTests]]></message>
<message level="high"><![CDATA[43/43 test(s) Passed]]></message>
<message level="high" />
<message level="high"><![CDATA[Summary]]></message>
<message level="high"><![CDATA[-------]]></message>
<message level="high"><![CDATA[Test Run Completed.]]></message>
<message level="high"><![CDATA[ Passed 43]]></message>
<message level="high"><![CDATA[ ----------]]></message>
<message level="high"><![CDATA[ Total 43]]></message>
<message level="high"><![CDATA[Results file: E:\GEMS_Build\Integration\TestResults\GEMS.Shared.UnitTests.trx]]></message>
<message level="high"><![CDATA[Test Settings: Default Test Settings]]></message>
<message level="high"><![CDATA[Committing...]]></message>
<message level="high"><![CDATA[Visited Classes 20 of 26 (76.9230769230769)]]></message>
<message level="high"><![CDATA[Visited Methods 74 of 102 (72.5490196078431)]]></message>
<message level="high"><![CDATA[Visited Points 533 of 718 (74.2339832869081)]]></message>
<message level="high"><![CDATA[Visited Branches 141 of 243 (58.0246913580247)]]></message>
<message level="high" />
<message level="high"><![CDATA[==== Alternative Results (includes all methods including those without corresponding source) ====]]></message>
<message level="high"><![CDATA[Alternative Visited Classes 21 of 27 (77.7777777777778)]]></message>
<message level="high"><![CDATA[Alternative Visited Methods 91 of 125 (72.8)]]></message>
.... and it goes on and on with the other unit tests, but
I showed the above just to demonstrate that my unit tests are in fact being run
</target>
</project>
</msbuild>
这是我ccnet.config中的发布者部分
<publishers>
<statistics />
<xmllogger />
<artifactcleanup cleanUpMethod="KeepLastXBuilds"
cleanUpValue="50" />
<buildpublisher>
<sourceDir>E:\GEMS_Build\Integration\TestResults\</sourceDir>
<publishDir>E:\GEMS_Build\Integration_Artifacts\</publishDir>
<useLabelSubDirectory>true</useLabelSubDirectory>
</buildpublisher>
<merge>
<files>
<file>TestResults\GEMS.Shared.UnitTests.trx</file>
<file>TestResults\GEMS.Web.UnitTests.trx</file>
</files>
</merge>
</publishers>
我搜索了整个构建日志,以从.trx文件中的标记中查找单词。诸如TestResult,TestDefinitions,ResultSummary等之类的单词……我找不到它们(单词TestResult作为路径名的一部分出现)。 .trx文件显然没有被合并。...我缺少什么?
最佳答案
我认为问题是您在xmllogger之后合并了
资源:
http://www.cruisecontrolnet.org/projects/ccnet/wiki/File_Merge_Task