1

我有一个非常奇怪的情况,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)

我完全不知道可能导致这种情况的原因。有人有想法吗?

4

1 回答 1

0

OpenCover 在PDF中有一个关于构建集成的部分,它建议您预先注册分析器程序集,而不是使用 -register:user 开关。

于 2013-01-29T02:22:17.160 回答