commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Bruno P. Kinoshita" <ki...@apache.org>
Subject [ALL] jacoco-maven-plugin advantage over cobertura-maven-plugin (CODEC-161)
Date Wed, 30 Jan 2013 12:00:15 GMT
Hi all, 

I preferred to write to the mailing list with an [ALL] component tag instead of commenting
a resolved issue. I apologize if it was not the right choice.

In CODEC-161, the following if statement could never reach 100% coverage with cobertura-maven-plugin:

if ((sumLength >= 5) && (sumLength <= 7))


The branch where both boolean expressions are false can never be covered with cobertura instrumentation,
even when the whole interval is tested (<5, >=5, <=7 and >7). As Sebb pointed
out, this could be rewritten as:

if (!(sumLength < 5 || sumLength > 7))


And then cobertura-maven-plugin could reach 100% coverage. There is already an issue in cobertura-maven-plugin
for this [1], but looks like it won't be fixed any soon. 

However, using jacoco-maven-plugin, it correctly interprets that the whole interval is covered,
without the need to rewrite the if statement. 

Also, using -Djacoco.skip=true skipped the jacoco execution (I think the cobertura-maven-plugin
has some issues skipping its execution in maven).

The jacoco-maven-plugin is still in 0.6.1.20121212... version, but it may be useful in case
a component has problems with the cobertura-maven-plugin. Sonar supports jacoco too.

In case someone would like to try, there is a sample project with junit + jacoco-maven-plugin
in github [2].

Cheers,


[1] http://sourceforge.net/tracker/?func=detail&aid=3097325&group_id=130558&atid=720015
[2] https://github.com/kinow/tests-for-coverage

Bruno P. Kinoshita
http://kinoshita.eti.br
http://tupilabs.com 

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@commons.apache.org
For additional commands, e-mail: dev-help@commons.apache.org


Mime
View raw message