Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

(build) Code Coverage #11

Open
vexx32 opened this issue Feb 14, 2022 · 0 comments
Open

(build) Code Coverage #11

vexx32 opened this issue Feb 14, 2022 · 0 comments

Comments

@vexx32
Copy link
Member

vexx32 commented Feb 14, 2022

While sorting out #9 I found that our default configuration for Coverlet/OpenCover for test coverage seemingly doesn't work great for this project.

Without the coverlet project reference in the csproj of the Tests project, this message is shown after the test results are emitted in the build log (all tests pass for both netcoreapp3.1 and net48):

Committing...
No results, this could be for a number of reasons. The most common reasons are:
    1) missing PDBs for the assemblies that match the filter please review the
    output file and refer to the Usage guide (Usage.rtf) about filters.
    2) the profiler may not be registered correctly, please refer to the Usage
    guide and the -register switch.

With a coverlet project reference in the Tests project, the behaviour changes completely:

Slightly long, click to expand
C:\Users\Joel\.nuget\packages\coverlet.msbuild\3.0.3\build\coverlet.msbuild.targets(39,5): warning : [coverlet] BadImageFormatException during MetadataReaderProvider.FromPortablePdbStream in InstrumentationHelper.PortablePdbHasLocalSource, unable to check if module has got local source. [C:\Users\Joel\source\repos\rhino-licensing\test\Rhino.Licensing.Tests\Rhino.Licensing.Tests.csproj]
Test run for C:\Users\Joel\source\repos\rhino-licensing\test\Rhino.Licensing.Tests\bin\Release\netcoreapp3.1\Rhino.Licensing.Tests.dll (.NETCoreApp,Version=v3.1)
Microsoft (R) Test Execution Command Line Tool Version 16.9.4
Copyright (c) Microsoft Corporation.  All rights reserved.

Starting test execution, please wait...
A total of 1 test files matched the specified pattern.

Passed!  - Failed:     0, Passed:    12, Skipped:     0, Total:    12, Duration: 8 s - Rhino.Licensing.Tests.dll (netcoreapp3.1)

Calculating coverage result...
  Generating report 'C:\Users\Joel\source\repos\rhino-licensing\code_drop\TestCoverage\coverlet\Rhino-Licensing-Tests.netcoreapp3.1.opencover.xml'

+-----------------+--------+--------+--------+
| Module          | Line   | Branch | Method |
+-----------------+--------+--------+--------+
| Rhino.Licensing | 55.05% | 58.26% | 54.54% |
+-----------------+--------+--------+--------+

+---------+--------+--------+--------+
|         | Line   | Branch | Method |
+---------+--------+--------+--------+
| Total   | 55.05% | 58.26% | 54.54% |
+---------+--------+--------+--------+
| Average | 55.05% | 58.26% | 54.54% |
+---------+--------+--------+--------+

C:\Users\Joel\.nuget\packages\coverlet.msbuild\3.0.3\build\coverlet.msbuild.targets(39,5): warning : [coverlet] BadImageFormatException during MetadataReaderProvider.FromPortablePdbStream in InstrumentationHelper.PortablePdbHasLocalSource, unable to check if module has got local source. [C:\Users\Joel\source\repos\rhino-licensing\test\Rhino.Licensing.Tests\Rhino.Licensing.Tests.csproj]
Test run for C:\Users\Joel\source\repos\rhino-licensing\test\Rhino.Licensing.Tests\bin\Release\net48\Rhino.Licensing.Tests.dll (.NETFramework,Version=v4.8)
Microsoft (R) Test Execution Command Line Tool Version 16.9.4
Copyright (c) Microsoft Corporation.  All rights reserved.

Starting test execution, please wait...
A total of 1 test files matched the specified pattern.
[xUnit.net 00:00:00.79] Skipping: Rhino.Licensing.Tests (could not find dependent assembly 'Rhino.Licensing, Version=1.5.0')
No test is available in C:\Users\Joel\source\repos\rhino-licensing\test\Rhino.Licensing.Tests\bin\Release\net48\Rhino.Licensing.Tests.dll. Make sure that test discoverer & executors are registered and platform & framework version settings are appropriate and try again.

Additionally, path to test adapters can be specified using /TestAdapterPath command. Example  /TestAdapterPath:<pathToCustomAdapters>.

Calculating coverage result...
  Generating report 'C:\Users\Joel\source\repos\rhino-licensing\code_drop\TestCoverage\coverlet\Rhino-Licensing-Tests.net48.opencover.xml'

+-----------------+------+--------+--------+
| Module          | Line | Branch | Method |
+-----------------+------+--------+--------+
| Rhino.Licensing | 0%   | 0%     | 0%     |
+-----------------+------+--------+--------+

+---------+------+--------+--------+
|         | Line | Branch | Method |
+---------+------+--------+--------+
| Total   | 0%   | 0%     | 0%     |
+---------+------+--------+--------+
| Average | 0%   | 0%     | 0%     |
+---------+------+--------+--------+

That is, the first set of tests (netcoreapp3.1) emits a warning, runs anyway, and produces a coverage report. Then the second set of tests (net48) emits the same warning, then an additional one from xUnit that states there are no tests at all in the tests assembly. Not sure what to make of that.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant