Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Coveralls.io

7 views
Skip to first unread message

David Cantrell

unread,
Mar 20, 2015, 8:00:06 AM3/20/15
to per...@perl.org
I recently found coveralls.io, a service that works nicely with
travis-ci to generate coverage reports whenever I push changes to my
github repos. For example ...

This commit:
https://github.com/DrHyde/perl-modules-Data-Compare/commit/6ad1fa9783f
caused this build:
https://travis-ci.org/DrHyde/perl-modules-Data-Compare/jobs/55114220
which generated this coverage report:
https://coveralls.io/builds/2155129/source?filename=lib%2FData%2FCompare.pm

It's a great service, and I recommend it. I followed these simple
instructions to get it working:
http://onionstand.blogspot.com.br/2015/03/how-to-add-online-code-badges-to-your.html

However, Coveralls appears to have some limitations, at least with its
default settings. Compare the report above with this report generated
for the same code:
http://cpancover.com/latest//Data-Compare-1.25/lib-Data-Compare-pm.html

Coveralls appears to only count the number of statements hit and not
look at whether my tests cover all the conditions in my code. Given code
like this:

if($foo && $bar) { print "Wibble" }

Then Coveralls will report 100% coverage if you test it with $foo and
$bar true, because then every statement will get hit. Devel::Cover,
however, will only be truly happy if you test with all of the following:
$foo false;
$foo true, $bar false;
$foo true, $bar true
so that you exercise all the possibilities that matter.

Does anyone know if there's some option I can tweak in Coveralls to turn
this on? Or is it a limitation of the website and/or the
Devel::Cover::Report::Coveralls module?

--
David Cantrell | top google result for "internet beard fetish club"

comparative and superlative explained:

<Huhn> worse, worser, worsest, worsted, wasted

Paul Johnson

unread,
Mar 20, 2015, 9:15:05 AM3/20/15
to David Cantrell, per...@perl.org
On Fri, Mar 20, 2015 at 11:42:32AM +0000, David Cantrell wrote:

> Coveralls appears to only count the number of statements hit and not
> look at whether my tests cover all the conditions in my code.

> Does anyone know if there's some option I can tweak in Coveralls to turn
> this on? Or is it a limitation of the website and/or the
> Devel::Cover::Report::Coveralls module?

Last time I looked, Coveralls only supported line coverage. The report
module marks a line as covered if all of the statements on that line
have been covered. That's about the best that can be done, I think,
until Coveralls supports more powerful coverage criteria.

Many languages can provide code coverage nowadays, but there are still
not many that provide as powerful coverage criteria as Devel::Cover does
for Perl.

--
Paul Johnson - pa...@pjcj.net
http://www.pjcj.net

David Cantrell

unread,
Mar 20, 2015, 11:30:05 AM3/20/15
to per...@perl.org
On Fri, Mar 20, 2015 at 01:56:45PM +0100, Paul Johnson wrote:
> On Fri, Mar 20, 2015 at 11:42:32AM +0000, David Cantrell wrote:
> > Coveralls appears to only count the number of statements hit and not
> > look at whether my tests cover all the conditions in my code.
> > Does anyone know if there's some option I can tweak in Coveralls to turn
> > this on? Or is it a limitation of the website and/or the
> > Devel::Cover::Report::Coveralls module?
> Last time I looked, Coveralls only supported line coverage ...

Fair enough. It's still a damned useful service, and I recommend it. At
least, I'll recommend it until I write my own nasty hack that will do
better :-)

[wanders off to think about how to send Devel::Cover output from Travis
to his own machine]

--
David Cantrell | Godless Liberal Elitist

Please stop rolling your Jargon Dice and explain the problem
you are having to me in plain English, using small words.
-- John Hardin, in the Monastery
0 new messages