TestcontainersContainer.StartAsync breaks coverlet code coverage
See original GitHub issueDescribe 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:
- Make a new test project.
- Include DotNet.TestContainers & coverlet.msbuild
- Write a unit test, that calls the .StartAsync method.
- Run tests
dotnet test <test-project>.csproj /p:CollectCoverage=true /p:CoverletOutputFormat=cobertura
Expected behavior Code coverage is produced, as expected.
Screenshots

Version
- 1.3.0
- 1.4.0-beta.20200807.5
Issue Analytics
- State:
- Created 3 years ago
- Comments:12
Top 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 >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found

@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!
@MrDazLive event that works. I attached my example.zip, maybe that helps you to figure out the issue.