Skip to content

Coverage incorrectly reported as 0% for integration tests #1461

@TheMagnificent11

Description

@TheMagnificent11

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).

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

    Issue actions