New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

JMockit xml coverage contains wrong file path #322

Closed
maddingo opened this Issue Aug 26, 2016 · 3 comments

Comments

2 participants
@maddingo

maddingo commented Aug 26, 2016

JMockit version: 1.26

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

@rliesenfeld

This comment has been minimized.

Show comment
Hide comment
@rliesenfeld

rliesenfeld Aug 26, 2016

Member

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/MyClass.java" 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.

Member

rliesenfeld commented Aug 26, 2016

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/MyClass.java" 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

@maddingo

This comment has been minimized.

Show comment
Hide comment
@maddingo

maddingo Aug 29, 2016

If the coverage.xml file is inteded to follow the conventions of the Sonar Qube generic coverage file (http://docs.sonarqube.org/display/PLUG/Generic+Test+Coverage), 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.

maddingo commented Aug 29, 2016

If the coverage.xml file is inteded to follow the conventions of the Sonar Qube generic coverage file (http://docs.sonarqube.org/display/PLUG/Generic+Test+Coverage), 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

This comment has been minimized.

Show comment
Hide comment
@rliesenfeld

rliesenfeld Aug 29, 2016

Member

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.

Member

rliesenfeld commented Aug 29, 2016

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