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-unsubscr...@commons.apache.org
For additional commands, e-mail: dev-h...@commons.apache.org

Reply via email to