Currently using JaCoCo Maven Plugin (0.8.8) with Java 11 and SonarCloud. I noticed very minor discrepancy between the JaCoCo XML to the SonarCloud coverage report. I am concerned that if there is one difference there might be others.
Specifically, I noticed that a getter/setter is not shown as used/tested in SonarCloud. I am confident that the path to the XML report is correct.
<method name="getFoo" desc="()Ljava/lang/String;" line="148">
<counter type="INSTRUCTION" missed="0" covered="9"/>
<counter type="BRANCH" missed="0" covered="2"/>
<counter type="LINE" missed="0" covered="1"/>
<counter type="COMPLEXITY" missed="0" covered="2"/>
<counter type="METHOD" missed="0" covered="1"/>
</method>
<method name="setFoo" desc="(Ljava/lang/String;)V" line="152">
<counter type="INSTRUCTION" missed="0" covered="4"/>
<counter type="LINE" missed="0" covered="2"/>
<counter type="COMPLEXITY" missed="0" covered="1"/>
<counter type="METHOD" missed="0" covered="1"/>
</method>
ganncamp
(G Ann Campbell)
October 26, 2022, 1:39pm
2
Hi,
Welcome to the community!
Can we have a screenshot of the other half of this equation? I.e. the “not tested” getter/setter?
Â
Ann
Thanks. Here are the getter/setter
public String getFoo() {
return foo == null ? super.getFoo() : foo;
}
public void setFoo(String foo) {
this.foo = foo;
}
ganncamp
(G Ann Campbell)
October 26, 2022, 5:48pm
4
Hi,
I asked for a screenshot because I was hoping to see the marginal coverage markers.
Â
Ann
I had been using a different method name for the previous illustrations to keep it generic but this is the actual names I am using throughout
ganncamp
(G Ann Campbell)
October 27, 2022, 11:15am
6
Hi,
Thanks for the screenshot. One more thing, can I have the analysis log? I’d like to see the processing of the coverage report.
Â
Ann
which report do you want and where would i find it?
ganncamp
(G Ann Campbell)
October 27, 2022, 5:21pm
8
Hi,
I’m hoping to see the analysis job log, which you’ll find in your CI.
Â
Thx,
Ann
Thanks! That was the nudge I needed. The JaCoCo xml location definition was configured using a maven parameter instead of a literal relative path. Fixing this to be a relative path worked like a charm.
Thanks again for your help.
1 Like
system
(system)
Closed
November 3, 2022, 9:19pm
10
This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.