Skip to content

JMockit Coverage including test class in coverage report #265

@Judge40

Description

@Judge40

In a project which follows the Maven Standard Directory Layout a test class will be included in the coverage report.

Example directory layout:
image

When the coverage report is generated the below is seen in the report.
image

I tried setting 'coverage-srcDirs=src/main/java', but while that did have an effect the test class was still listed. I also tried excluding the filename pattern but saw the same result.
image

When multiple test classes exist it is still only a single test class which gets included in the report.

I tested with some earlier versions and it looks like the problem was first introduced in 1.20 but is still reproducible in 1.22.

In the test project ClassOne and ClassOneTest were actually very small classes, as below for reference, with only a single method/test respectively. Though this does not appear to be any factor as I've seen this in more complex projects originally.

public class ClassOne {
  public static ClassOne newClassOne() {
    return new ClassOne();
  }
}
public class ClassOneTest {
  @Test  
  public void testNewClassOne_classOneInstance() {
    ClassOne classOne = ClassOne.newClassOne();
    Assert.assertThat(classOne, CoreMatchers.instanceOf(ClassOne.class));
  }
}

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions