Skip to content

Coverlet doesnt calculate code coverage for tests until another test is added #1677

Closed
@ReneKochITTitans

Description

@ReneKochITTitans

we have 700 tests in our solution and we use the latest .net and latest coverlet.

3 test files in 1 (out of 30) test solutions are not calculated correctly:

enter image description here

But the tests are executed:

enter image description here

The mysterious thing is, that as soon as I copy the files into another solution, where already 10 more tests are executed, they will be seen:

enter image description here

Even no of the other files touching the EmailService.

It feels like a very wierd bug in coverlet.

A few more insight and what I tried already:

  • it is the sae on my computer as another devs as in a pipeline
  • downgrading coverlet or another packages doesnt help
  • the 2 solutions are exactly the same and have nearly the same csproj etc.
  • When I delete all files from the solution I copied the test into, the remeining tests of the emailService will not be seen again. Means, only when other tests are present it works.
  • the tests itself are very boring, creating a service, calling a db, reading from it, Assert.Multiple + Assert.That and finished.

Example test:

´´´ [Test]
[AutoData]
public void ApplyDesignTemplate_ValidInput_TemplateWithoutBodyUnchanged(
DesignTemplateLogicService service,
TranslationData data)
{
// Arrange
string designTemplate = "This is a template without the body replacement token.";

        // Act
        var result = service.ApplyDesignTemplate(designTemplate, data);

        // Assert
        Assert.That(result, Is.EqualTo(designTemplate));
    }´´´

Json Output stand alone:
enter image description here

Json Output with in touch of other tests:
enter image description here

Any ideas?

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions