In a project which follows the Maven Standard Directory Layout a test class will be included in the coverage report.
Example directory layout:
When the coverage report is generated the below is seen in the report.
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.
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.
There is a sample test suite in the JMockit repository, "samples/petclinic" (https://github.com/jmockit/jmockit1/tree/master/samples/petclinic), which uses the standard Maven directory layout, and the coverage tool. Yet, I don't see test classes appearing in the HTML report.
So, I would need more information (in particular, a pom.xml file) so the problem can be reproduced.
The project I noticed this in was actually a gradle project and the "ClassOne" test project was just a fresh Eclipse project from scratch.
Anyway, I tried your sample test suite and that all worked fine. So I did a bit of investigation and figured out what was going on.
If the "output" folder for "src/test/java/" does not end with "test-classes" then the test class will be listed in the report.
Changing my "ClassOne" test project to use the "test-classes" folder structure does cause the report to be output as expected.
Is it expected that the "test-classes" structure should always be used?
Note that I checked with 1.19 and that still works as expected regardless of the test classes output folder structure.
Also, it might be worth nothing that for me the test class shown in the report always seems to be the first test class to run (this is when running JUnit test through Eclipse).
In a project which follows the Maven Standard Directory Layout a test class will be included in the coverage report.
Example directory layout:

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

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.

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.
The text was updated successfully, but these errors were encountered: