jatill has asked for the wisdom of the Perl Monks concerning the following question:

Is there any easy way to run all of my tests through Devel::Cover at once via a prove command?

Replies are listed 'Best First'.
Re: Devel::Cover and prove
by gellyfish (Monsignor) on Jun 09, 2006 at 12:29 UTC

    Yes, just do:

    HARNESS_PERL_SWITCHES=-MDevel::Cover prove t
    Assuming your tests are all in the directory 't'

    /J\

Re: Devel::Cover and prove
by jatill (Beadle) on Jun 09, 2006 at 12:33 UTC
    I've seen that before, but I'm sure I'm missing something. If I put HARNESS_PERL_SWITCHES=-MDevel::Cover prove t at the command line, I get HARNESS_PERL_SWITCHES=-MDevel::Cover: Command not found.

      Fine, your shell doesn't understand that way of setting an environment variable before running a program. Simply put all you have to do is set the environment variable "HARNESS_PERL_SWITCHES" to "-MDevel::Cover" before running prove, I won't bother giving you the specific syntax but I am sure you can work it out for yourself.

      /J\

      Hi

      cover -delete HARNESS_PERL_SWITCHES=-MDevel::Cover make test
      The first command deletes any existing coverage database. On the second line we set an environment variable for Test::Harness, HARNESS_PERL_SWITCHES to a Perl command-line switch that imports Devel::Caller. This is all that's required of you. Each of your test programs will now run with Devel::Caller loaded and analyzing execution in the background.

      perl.com for more information.

      "Keep pouring your ideas"
Re: Devel::Cover and prove
by jesuashok (Curate) on Jun 09, 2006 at 12:34 UTC
    Hi

    Please refere Devel::Core
    The solution is documented there.

    "Keep pouring your ideas"