質問

I have a really weird situation where OpenCover isn't producing results under CruiseControl.NET, but if I run the identical command-line from the command prompt, it does produce results.

The following is from my CruiseControl build log:

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)

But it I then copy and paste this command-line:

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

into a command prompt from the directory defined as the workingDirectory in my msbuild XML, I get the following results:

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)

I'm completely stumped on what could be causing this. Anyone have ideas?

役に立ちましたか?

解決

OpenCover has a section on build integration in the PDF where it recommends that you pre-register the profiler assemblies and not use the -register:user switch.

ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top