Skip to content

Coverage results are incorrect. #18

Closed
@StillLearnin

Description

@StillLearnin

I have 3 projects and 21 tests all written against Candle.Services

Candle.DbContext
   |
   +--(References) Candle.Services
   |    |
   +----+--(References) Candle.Services.Tests

Calculating coverage result...
  Generating report 'C:\..\Candle.Services.Tests\coverage.json'

+------------------+----------+
| Module           | Coverage |
+------------------+----------+
| Candle.DbContext | 21%      |
+------------------+----------+
| Candle.Services  | 0%       |
+------------------+----------+

Activity

tonerdo

tonerdo commented on Mar 26, 2018

@tonerdo
Collaborator

@StillLearnin take a look at the actual coverage results file. This could be a bug in just the summary generation

StillLearnin

StillLearnin commented on Mar 26, 2018

@StillLearnin
Author

Here's a sample:

For what it's worth, the Get() method is in a base class.

Actual code being tested:

image

coverage.json relevant portion:

   "Candle.Services.SubjectsService/<ListAsync>d__3": {
    "System.Void Candle.Services.SubjectsService/<ListAsync>d__3::MoveNext()": {
     "33": 0,
     "34": 0,
     "35": 0,
     "36": 0,
     "37": 0
    }
   }

Test with ListAsync() highlighted:

image

StillLearnin

StillLearnin commented on Mar 26, 2018

@StillLearnin
Author

See #7 also. I started this new issue because I thought #7 might have been fixed with the previous pull requests or might be a different issue.

tonerdo

tonerdo commented on Mar 26, 2018

@tonerdo
Collaborator

This doesn't look like much of a #7 issue. I'm thinking it might have something to do with all async methods. Although, one of Coverlet's users did mention that it works well with async tests. Is this project open source?

StillLearnin

StillLearnin commented on Mar 26, 2018

@StillLearnin
Author

Not open source but I trimmed the project down to about 1/10th its size and can still reproduce the issue. You can get the trimmed down version here

StillLearnin

StillLearnin commented on Mar 26, 2018

@StillLearnin
Author

I think it may be an issue with timing or memory usage because if you comment out line 16 in Main so as to not seed postal codes, coverlet seems to work.

The other option that fixes the issue is to trim down PostalCodesUSA.csv until the total number of lines doesn't exceed ~2000. It doesn't matter which lines you take out, just that the total number of lines is sufficiently small.

tonerdo

tonerdo commented on Mar 26, 2018

@tonerdo
Collaborator

Thanks for providing the repro project. I'll clone it and check things out

StillLearnin

StillLearnin commented on Mar 29, 2018

@StillLearnin
Author

If you could give me some instructions on how to debug this type of project I'd be glad to tackle it.

tonerdo

tonerdo commented on Apr 2, 2018

@tonerdo
Collaborator

@StillLearnin I figured out the problem. The CoverageTracker class writes to the hits file when the ProcessExit event is thrown, however, because there's so many hits to write it's unable to finish within the ~200ms window. There are a lot less hits when you comment out that line that's why it's able to finish successfully.

tonerdo

tonerdo commented on Apr 2, 2018

@tonerdo
Collaborator

I'm gonna look for a more efficient way to write to the hits result file

StillLearnin

StillLearnin commented on Apr 3, 2018

@StillLearnin
Author

I'd be glad to take a look at this and open a pull request

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

      Development

      No branches or pull requests

        Participants

        @StillLearnin@tonerdo

        Issue actions

          Coverage results are incorrect. · Issue #18 · coverlet-coverage/coverlet