http://qs321.pair.com?node_id=444965


in reply to Re: Devel::Cover tutorial wanted
in thread Devel::Cover tutorial wanted

Thanks for your clear response.

Devel::Cover tells you how much of your code your tests are exercising. So, if you don't hook it into your tests, how is it supposed to do its job?

Agreed - but as noted, running against the test harness script gives no practical output. I can do it against each .t script individually, but that's a pain. When you run use Devel::Cover, do you run it against a script that calls all your tests, or some other way?

Personally, I think your layout is borked. There is no reason to put your t/ directory under lib/Foo/Bar, just because the Foo/Bar levels have no files.

I'll move up the t/ directory. The docs/ is a typo in my node. The real dir is called document_root/, which isn't exactly inspired itself.

Update: clarified docs/ layout

Replies are listed 'Best First'.
Re^3: Devel::Cover tutorial wanted
by mpeters (Chaplain) on Apr 05, 2005 at 15:11 UTC
    Since you are running under mod_perl you need to tell Devel::Cover to look at the code that's being run by apache. Put something like this into your startup.pl. (Or modperl_extra.pl if you are using Apache::Test which I recommend anyway for testing a mod_perl application).
    use Devel::Cover ('+select' => 'My/Module', '+silent');
    Then I would recommend that you look at using something like Module::Build to create your test harness. With it, you can simply run make testcover and it will take care of making sure the test harness has Devel::Cover enabled.
Re^3: Devel::Cover tutorial wanted
by dragonchild (Archbishop) on Apr 05, 2005 at 13:13 UTC
    . . . running against the test harness script gives no practical output.

    How are you doing this? What does your test.pl look like? Is there a reason you're not using prove or 'make test'?

      The best/worst reason: ignorance.

      My test.pl script looks like very like the synopsis from Test::Harness. But, now I've seen it, I'll be using prove from now on.

      The modules are not built with ExtUtils::MakeMaker or Module::Build, so I can't use make test.

      I've a lot to learn yet, so thanks for helping me.