Re: Using NYTProf for code coverage?

[email protected] (David Cantrell)
Newsgroups perl.qa
Message-ID <[email protected]>
On Wed, Feb 27, 2013 at 08:49:44AM -0500, Mark Stosberg wrote:

> I was tasked with working on code coverage for a large project, but had
> difficulty getting Devel::Cover to run. We had Devel::NYTProf handy,
> and I realized that although that tool focuses on profiling, it produces
> data that appears that it can be used for code coverage instead.
> 
> Having one tool that could be used for both profiling and code coverage
> seems like a nice win. Have other people looked into using
> Devel::NYTProf this way? Is there a reason why it would be undesirable?
> Is Devel::Cover still the go-to tool for code coverage?

Devel::Cover tells you a lot more than just whether a line of code was
executed.  Consider a line like this:

  do_something if($foo || $bar);

Devel::Cover will tell you which of the three possible conditions were
covered by your tests, those being:
  * neither $foo nor $bar are true;
  * $foo is false, $bar is true;
  * $foo is true and we don't care about $bar

I'm surprised that you can bet NYTProf working but not Cover - in my
experience, they either both work easily or both fail horribly.

-- 
David Cantrell | Bourgeois reactionary pig

    Vegetarian: n: a person who, due to malnutrition caused by
      poor lifestyle choices, is eight times more likely to
      catch TB than a normal person
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.