On May 21, 2004, at 12:02 PM, Geoffrey Young wrote:


Full coverage isn't always possible, and the lack of it isn't
necessarily a problem.

I fully agree. however, once you start using a tool like this, management
will inevitably ask "what's that 93% about?" and the answer is sometimes
complex and subject to judgement: "well, Devel::Cover is just a guideline,
and these few cases are really limitations of the software. but I've
checked them out so we're really at 100%"


I think a nice future feature might be some way to predeclare conditions
that you understand. for instance, given


  $x ||= func();

I might like to signal Devel::Cover that func() has a constant return (or
lack thereof).

I don't know if I would like this feature. To me it would allow you to falsely skew the results of the Devel::Cover output. I look at Devel::Cover as a harshly objective analysis of my test-code coverage, anything destroying that objectivity IMO would lessen the value of the tool.


If you are looking to satisfy management, then I would suggest not running/showing branch and conditional coverage, as they can be tricky, and just showing statement and subroutine coverage (and maybe POD too) since it is much easier to get 100% on those. Sometimes, too much information can hurt, and it can be a slippery slope to try and explain to some why branch/cond coverage sometimes can never be 100%.


 another thing that is keeping me from 100% right now is the
classic

my $class = ref $self || $self;

I have learned to just accept that this idiom will always keep me away from 100%.



where the only way to satisfy the conditional is to call My::Foo::bar() using functional syntax instead of a method syntax.

I always used the above code (ref $class || $class) as a means of handling this type of code:


        $my_foo_bar_instance->new();

Or to facilitate subclassing. To write a test to satisfy the coverage, but that doesn't actually test the (or any) intended usage, IMO weakens your overall test.


granted, if I were to somehow signal Devel::Cover that some "false, false"
condition will never be raised and that's ok, I'm leaving myself open to
code that misbehaves exactly on that condition.

Why signal Devel::Cover though? Why not just know it in your head and if you have too, explain it to those who need to understand it. Devel::Cover should be 100% objective.



but this entire methodology
is only part of the picture anyway, even at 100%. and sometimes it's all
about the green :)

I agree, ya gotta love the green :) (at least until Paul changes it to a different color).


Steve


--Geoff




Reply via email to