我已经使用 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 文件显然没有被合并到......我错过了什么?