JMockit xml coverage contains wrong file path #322

maddingo opened this Issue Aug 26, 2016 · 3 comments


None yet

2 participants


JMockit version: 1.26

The file path in the coverage.xml is "com/mycorp/"
It should be "src/main/java/com/mycorp/"


Ok, but how can JMockit know that the source file is under the "src/main/java/" directory, rather than, say, "src/"?

The coverage tool obtains "com/mycorp/" from the "MyClass.class" file, which comes from some "classes/" directory somewhere, usually. To figure out what directory is the correct source root, it would need to search the filesystem (as the HTML report does, but that one needs to locate the sources anyway in order to read them). I would think that generation of an XML data file would not need to be concerned with the location of source files.

@rliesenfeld rliesenfeld added the other label Aug 26, 2016

If the coverage.xml file is inteded to follow the conventions of the Sonar Qube generic coverage file (, it should contain the file name of the Java file relative to the module root. The sourceDir is already a configuration parameter. And as you say, the HTML report already tries to find the source file.

@rliesenfeld rliesenfeld added bug and removed other labels Aug 29, 2016
@rliesenfeld rliesenfeld self-assigned this Aug 29, 2016
rliesenfeld commented Aug 29, 2016 edited

Ok, it says the path should be "relative to the root of the module". I will change it to use the "coverage-srcDirs" property as the module source root.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment