我有一个非常奇怪的情况,OpenCover没有在CruiseControl.NET下产生结果,但如果我从命令提示符运行相同的命令行,它确实会产生结果。
以下内容来自我的CruiseControl构建日志:
Build started 01/25/2013 10:11:10
Project "E:\GEMS_Build\Integration\Coverage.xml" (Coverage target(s)):
Target "Coverage":
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\shared.coverage.xml" -targetargs:"/testcontainer:E:\GEMS_Build\Integration\src\GEMS.Shared\GEMS.Shared.UnitTests\bin\Debug\GEMS.Shared.UnitTests.dll" -filter:"+[*]*" -mergebyhash
Microsoft (R) Test Execution Command Line Tool Version 11.0.50727.1
Copyright (c) Microsoft Corporation. All rights reserved.
Loading E:\GEMS_Build\Integration\src\GEMS.Shared\GEMS.Shared.UnitTests\bin\Debug\GEMS.Shared.UnitTests.dll...
Starting execution...
Results Top Level Tests
------- ---------------
Passed GEMS.Shared.UnitTests.Data.FilterTests.ANDFilterTest
Passed GEMS.Shared.UnitTests.Data.FilterTests.BasicFilterTest
Passed GEMS.Shared.UnitTests.Data.FilterTests.FilterEncodeDecodeTest
Passed GEMS.Shared.UnitTests.Data.FilterTests.ORFilterTest
Passed GEMS.Shared.UnitTests.Data.FilterTests.ValidateFieldsTest
Passed GEMS.Shared.UnitTests.Security.ActiveDirectoryHelperUnitTests.GetAllUsers
Passed GEMS.Shared.UnitTests.Tasks.AsyncHelperTests.NoParameter
Passed GEMS.Shared.UnitTests.Tasks.AsyncHelperTests.NoParameterWithCallback
Passed GEMS.Shared.UnitTests.Tasks.AsyncHelperTests.OneParameterNoCallback
Passed GEMS.Shared.UnitTests.Tasks.AsyncHelperTests.OneParameterWithCallback
Passed GEMS.Shared.UnitTests.Text.StringExtensionsTests.TestPlurals
11/11 test(s) Passed
Summary
-------
Test Run Completed.
Passed 11
----------
Total 11
Results file: E:\GEMS_Build\Integration\TestResults\SYSTEM_GCOVA38 2013-01-25 10_11_14.trx
Test Settings: Default Test Settings
Committing...
No results - no assemblies that matched the supplied filter were instrumented
this could be due to missing PDBs for the assemblies that match the filter
please review the output file and refer to the Usage guide (Usage.rtf)
但是我随后复制并粘贴了这个命令行:
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\shared.coverage.xml" -targetargs:"/testcontainer:E:\GEMS_Build\Integration\src\GEMS.Shared\GEMS.Shared.UnitTests\bin\Debug\GEMS.Shared.UnitTests.dll" -filter:"+[*]*" -mergebyhash
从我的msbuild XML中定义为workingDirectory的目录进入命令提示符,我得到以下结果:
Microsoft (R) Test Execution Command Line Tool Version 11.0.50727.1
Copyright (c) Microsoft Corporation. All rights reserved.
Loading E:\GEMS_Build\Integration\src\GEMS.Shared\GEMS.Shared.UnitTests\bin\Debug\GEMS.Shared.UnitTests.dll...
Starting execution...
Results Top Level Tests
------- ---------------
Passed GEMS.Shared.UnitTests.Data.FilterTests.ANDFilterTest
Passed GEMS.Shared.UnitTests.Data.FilterTests.BasicFilterTest
Passed GEMS.Shared.UnitTests.Data.FilterTests.FilterEncodeDecodeTest
Passed GEMS.Shared.UnitTests.Data.FilterTests.ORFilterTest
Passed GEMS.Shared.UnitTests.Data.FilterTests.ValidateFieldsTest
Passed GEMS.Shared.UnitTests.Security.ActiveDirectoryHelperUnitTests.GetAllUsers
Passed GEMS.Shared.UnitTests.Tasks.AsyncHelperTests.NoParameter
Passed GEMS.Shared.UnitTests.Tasks.AsyncHelperTests.NoParameterWithCallback
Passed GEMS.Shared.UnitTests.Tasks.AsyncHelperTests.OneParameterNoCallback
Passed GEMS.Shared.UnitTests.Tasks.AsyncHelperTests.OneParameterWithCallback
Passed GEMS.Shared.UnitTests.Text.StringExtensionsTests.TestPlurals
11/11 test(s) Passed
Summary
-------
Test Run Completed.
Passed 11
----------
Total 11
Results file: E:\GEMS_Build\Integration\TestResults\pd7562_GCOVA38 2013-01-25 10_16_00.trx
Test Settings: Default Test Settings
Committing...
Visited Classes 17 of 30 (56.6666666666667)
Visited Methods 46 of 120 (38.3333333333333)
Visited Points 402 of 938 (42.8571428571429)
Visited Branches 76 of 279 (27.2401433691756)
==== Alternative Results (includes all methods including those without corresponding source) ====
Alternative Visited Classes 17 of 31 (54.8387096774194)
Alternative Visited Methods 55 of 146 (37.6712328767123)
我完全不知道可能导致这种情况的原因。有人有想法吗?