You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@commons.apache.org by "Bruno P. Kinoshita" <ki...@apache.org> on 2013/01/30 13:00:15 UTC

[ALL] jacoco-maven-plugin advantage over cobertura-maven-plugin (CODEC-161)

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


Re: [ALL] jacoco-maven-plugin advantage over cobertura-maven-plugin (CODEC-161)

Posted by Olivier Lamy <ol...@apache.org>.
2013/1/30 Gary Gregory <ga...@gmail.com>:
> Is Cobertura dead? I'd prefer to keeping using a FOSS test coverage tool
> instead of one behind a license (Clover). Should we switch to Clover (we
> have a license for Apache)? What about Emma?
jacoco is epl.
Have a look at a nice comparison here:
http://www.dzone.com/links/r/code_coverage_tools_jacoco_cobertura_emma_compari.html
Not sure cobertura is still active:
http://cobertura.svn.sourceforge.net/viewvc/cobertura/

>
> Thoughts?
>
> Gary
>
>
> On Wed, Jan 30, 2013 at 7:00 AM, Bruno P. Kinoshita <ki...@apache.org>wrote:
>
>> 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
>>
>>
>
>
> --
> E-Mail: garydgregory@gmail.com | ggregory@apache.org
> JUnit in Action, 2nd Ed: <http://goog_1249600977>http://bit.ly/ECvg0
> Spring Batch in Action: <http://s.apache.org/HOq>http://bit.ly/bqpbCK
> Blog: http://garygregory.wordpress.com
> Home: http://garygregory.com/
> Tweet! http://twitter.com/GaryGregory



--
Olivier Lamy
Talend: http://coders.talend.com
http://twitter.com/olamy | http://linkedin.com/in/olamy

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


Re: [ALL] jacoco-maven-plugin advantage over cobertura-maven-plugin (CODEC-161)

Posted by Gary Gregory <ga...@gmail.com>.
Is Cobertura dead? I'd prefer to keeping using a FOSS test coverage tool
instead of one behind a license (Clover). Should we switch to Clover (we
have a license for Apache)? What about Emma?

Thoughts?

Gary


On Wed, Jan 30, 2013 at 7:00 AM, Bruno P. Kinoshita <ki...@apache.org>wrote:

> 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
>
>


-- 
E-Mail: garydgregory@gmail.com | ggregory@apache.org
JUnit in Action, 2nd Ed: <http://goog_1249600977>http://bit.ly/ECvg0
Spring Batch in Action: <http://s.apache.org/HOq>http://bit.ly/bqpbCK
Blog: http://garygregory.wordpress.com
Home: http://garygregory.com/
Tweet! http://twitter.com/GaryGregory