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.

Coverage incorrectly reported as 0% for integration tests

See original GitHub issue

I have a open source project that is using Coverlet to calculate test coverage.

The coverage seems to work correctly for unit tests.

However, coverage doesn’t get reported for integration tests.

The integration tests I’m running use Microsoft.AspNetCore.Mvc.Testing.WebApplicationFactory to bring up a ASP.Net Web API application in memory and then uses a HTTP client to make API calls to this in-memory application.

However, none of the code executed is being included in the coverage. It doesn’t even get the top-level controllers that get hit when the HTTP request is executed.

See this pull request for more details.

The dotnet test command is in the GitHub Action (dotnet test ./Lewee-CI.sln --configuration Release --no-build --collect "XPlat Code Coverage" --results-directory ./coverage).

Issue Analytics

  • State:closed
  • Created 6 months ago
  • Comments:12

github_iconTop GitHub Comments

1reaction
MarcoRossignolicommented, Jun 12, 2023

I didn’t have time to check yet, I’m pretty busy this period.

let’s see if @daveMueller @petli has got some fresh ideas.

0reactions
TheMagnificent11commented, Jun 12, 2023

I feel rather embarrassed.

The tests that were supposed to contribute to coverage (in both my original repository and the experiment repository) were using BDDfy, but I wasn’t adding the BDDfy() method call at the end of my tests 🤦

The super-fast speed of execution of the tests should have been a tell-tale sign.

I made the appropriate changes in my experiment repository and the coverage looked correct.

Sorry about the hassle.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Why 0% in Jacoco coverage for integration tests
I have setup maven project to get the integration test coverage in my it profile. But the jacoco report shows 0% for all...
Read more >
Some classes are incorrectly reported with zero coverage ...
I am running integration tests against my application, which is a JAX-RS application deployed on Jetty. The execution data is collected by ...
Read more >
Should integration test coverage allow for lower unit ...
If a project has 30% coverage by unit tests, 40% due to integration tests, is it fair to say the total is 70%...
Read more >
Creating Code Coverage Reports for Unit and Integration ...
This blog post describes how we can create code coverage reports for unit and integration tests by using the JaCoCo Maven plugin.
Read more >
Code coverage testing - Visual Studio (Windows)
To Show 0% covered, enter "Not Covered (%Lines)":"0" in the search box. Manage code coverage results. The Code Coverage Results window usually ...
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