question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Include doesn't seem to work

See original GitHub issue

Using the NuGet integration (haven’t tried the global tool), I want to be able to include only the coverage from the project I’m unit testing.

I have multiple projects and multiple test projects:

  • StackState.Core
  • StackState.Core.UnitTests
  • StackState.CLI
  • StackState.Monitor
  • StackState.Monitor.UnitTests

When I generate coverage for the “StackState.Monitor.UnitTests” project, without specifying any include or exclude filters, the result is this:

+---------------------------+--------+--------+--------+ | Module | Line | Branch | Method | +---------------------------+--------+--------+--------+ | StackState.Core | 0,4% | 0% | 0,7% | +---------------------------+--------+--------+--------+ | StackState.Core.UnitTests | 4,4% | 0% | 6,8% | +---------------------------+--------+--------+--------+ | StackState.Monitor | 37,6% | 21,7% | 56,5% | +---------------------------+--------+--------+--------+

When I add “/p:Exclude=”[StackState.Core*]*“”, the result is:

+--------------------+--------+--------+--------+ | Module | Line | Branch | Method | +--------------------+--------+--------+--------+ | StackState.Monitor | 37,6% | 21,7% | 56,5% | +--------------------+--------+--------+--------+

The above is actually what I want, but I want to get this result by INcluding the one project that 1 want coverage for and not EXcluding everything else. Besides that it’s cumbersome, it’s also currently not possible to do from a PowerShell window: https://github.com/tonerdo/coverlet/issues/182. Anyway, changing the parameter to “/p:Include=”[StackState.Monitor*]*“” results again in:

+---------------------------+--------+--------+--------+ | Module | Line | Branch | Method | +---------------------------+--------+--------+--------+ | StackState.Core | 0,4% | 0% | 0,7% | +---------------------------+--------+--------+--------+ | StackState.Core.UnitTests | 4,4% | 0% | 6,8% | +---------------------------+--------+--------+--------+ | StackState.Monitor | 37,6% | 21,7% | 56,5% | +---------------------------+--------+--------+--------+

Either I’m doing something wrong, or the include setting doesn’t seem to work.

So why is this an issue at all? I’m trying to get Coverage Gutters working together with Coverlet, but when Code Gutters finds multiple coverage files with overlapping values it seems to pick the last one and not combine the data. As combining coverage results isn’t possible yet with Coverlet as well, this seems to be my only way out.

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Reactions:1
  • Comments:11

github_iconTop GitHub Comments

1reaction
MarcoRossignolicommented, Sep 30, 2019

this bug is solved I did a test with last version 2.7.0 and this is my result of repro.

C:\git\coverletissue\CoverletIncludeIssues (master -> origin)
λ dotnet test Demo2.Test /p:CollectCoverage=true /p:Include="[Demo2]*
Test run for C:\git\coverletissue\CoverletIncludeIssues\Demo2.Test\bin\Debug\netcoreapp2.1\Demo2.Test.dll(.NETCoreApp,Version=v2.1)
Microsoft (R) Test Execution Command Line Tool Version 16.3.0
Copyright (c) Microsoft Corporation.  All rights reserved.

Starting test execution, please wait...

A total of 1 test files matched the specified pattern.

Test Run Successful.
Total tests: 1
     Passed: 1
 Total time: 1,7034 Seconds

Calculating coverage result...
  Generating report 'C:\git\coverletissue\CoverletIncludeIssues\Demo2.Test\coverage.json'

+--------+------+--------+--------+
| Module | Line | Branch | Method |
+--------+------+--------+--------+
| Demo2  | 100% | 100%   | 100%   |
+--------+------+--------+--------+

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

I’m going to close…feel free to reopen if needed.

1reaction
ElephantsGeraldcommented, Sep 24, 2018

I’m having the same problem: /p:Include is not working.

Read more comments on GitHub >

github_iconTop Results From Across the Web

php include doesn't work even inside the same folder
php include doesn't work even inside the same folder · 1. try by adding some space-> <?php include "reg. · 1. what error...
Read more >
Filtered Include Does Not Seem to work in Tests #26482
I have a simple filtered include that I am trying to test. In the test, it seemed to be ignoring the filter part...
Read more >
includes not working (yes I've read all - C++ Forum
I am including the state_Menu header in problem.h because I want to use the class state_Menu in problem.cpp file. I have tried doing...
Read more >
Why "not includes" doesn't work? - JavaScript
I'm trying to solve this using a for loop so I can iterate through the args and solve the problem of having more...
Read more >
Arduino: why does simple include not work
You don't need to include, just call functions from another file. It handles for you.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found