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.

TestcontainersContainer.StartAsync breaks coverlet code coverage

See original GitHub issue

Describe the bug When using test containers as part of a test scenario, calling container.StartAsync will result in code coverage producing inaccurate results.

Code coverage may return 0% coverage, whereas removing the .StartAsync method will return the expected code coverage.

To Reproduce Steps to reproduce the behaviour:

  1. Make a new test project.
  2. Include DotNet.TestContainers & coverlet.msbuild
  3. Write a unit test, that calls the .StartAsync method.
  4. Run tests dotnet test <test-project>.csproj /p:CollectCoverage=true /p:CoverletOutputFormat=cobertura

Expected behavior Code coverage is produced, as expected.

Screenshots image

Version

  • 1.3.0
  • 1.4.0-beta.20200807.5

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:12

github_iconTop GitHub Comments

1reaction
MrDazLivecommented, Aug 15, 2020

@HofmeisterAn I can confirm that this works in 1.4.0-beta.20200815.5. I have also verified this in the project that it was originally noticed.

Thanks alot, for the quick turn around!

1reaction
HofmeisterAncommented, Aug 14, 2020

@MrDazLive event that works. I attached my example.zip, maybe that helps you to figure out the issue.

Bildschirmfoto 2020-08-14 um 18 04 41
Read more comments on GitHub >

github_iconTop Results From Across the Web

TestcontainersContainer.StartAsync breaks coverlet code ...
StartAsync will result in code coverage producing inaccurate results. Code coverage may return 0% coverage, whereas removing the .StartAsync ...
Read more >
Use code coverage for unit testing - .NET
This article discusses the usage of code coverage for unit testing with Coverlet and report generation using ReportGenerator. While this article ...
Read more >
Coverlet won't break CircleCI
I want to make my CI break on branches when code coverage is bellow a threshold. Currently I'm using coverlet for this objective, ......
Read more >
Mastering Code Coverage Analysis for .NET Projects without ...
Code coverage analysis is a useful tool for any developer looking to build high-quality, maintainable code. It helps identify gaps in your ...
Read more >
Collecting test coverage using Coverlet and SonarQube for ...
First, we'll need to have a piece of code that represents logic which should be submitted to unit testing. I've created a repository...
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