Thanks for all your helps.

I am new in Perl world, my situation is, for example:

- my modules, which I like to test, live in "tmp/experiment/lib" folder
- my test scripts, which are created to load and exercise the above modules, 
live in "tmp/experiment/tests" folder
- I call our internal test harness script, which is different from the CPAN 
test harness, to invoke the above tests in "tmp/experiment/tests" folder one by 
one to test and cover the modules in "tmp/experiment/lib" folder

I installed Devel::Cover module on my Linux box and I used
“perl -MDevel::Cover tmp/experiment/lib/module_one.pm” and I did get coverage 
data for module_one.pm. But I have questions:

(1)    My tests test1_module_one and test2_module_one are perl script to load 
and exercise module_one.pm’s subroutiones. So, what is the Devel::Cover command 
to call test scripts test1_module_one and test2_module_one, which load 
module_one.pm, to get test coverage data for module_one.pm?

(2)    One step further, as I mentioned, I actually need call our internal test 
harness script to kick off the two test scripts one by one to cover the 
modules_one.pm, so the scenario is that, my test harness script calls test 
scripts, and test scripts load module_one.pm and test it. So, what will be best 
strategy and commnds for me to use Devel::Cover to achieve the goal => call my 
test harness script and get the code coverage data on module_one.pm by running 
the two tests.

I am new in Perl and Devel::Cover, so pleaes help and give detail info.

Thanks again and looking forward to getting your further advice!

Scott

James E Keenan <[EMAIL PROTECTED]> wrote: Scott Wang wrote:
> Hi ,
> 
> I am new to use Devel::Cover.
> 
> We have lots of product Perl modules in our product "lib" folder and we have 
> lots of Perl test scripts to cover those modules, right now, we are trying to 
> get the code coverage metrics for our tests on those modules. I find we might 
> get help by using Devel::Cover, would you please give me some idea on how I 
> should use the Devel::Cover to generate our tests coverage metrics on our 
> Perl modules?
> 


Are you asking for assistance in how to get stats for a *single* Perl 
module?  If so, that's easy (and easily learned from the docs):

perl Makefile.PL
make
cover -delete
make test HARNESS_PERL_SWITCHES=-MDevel::Cover
cover

That creates a subdirectory cover_db/which holds the database created by 
running Devel::Cover, as well as HTML files which vividly display what's 
covered and what's not by statement, branch, condition, subroutine, etc.

When I'm developing a Perl module I sometimes like to save text versions 
coverage reports in a separate subdirectory.  So I'll call:

cover cover_db --report=text > coverage.mymodule.myversionnumber.txt

If, on the other hand, you're asking how to collate the results of 
running Devel::Cover on *many* modules, well, that's something I haven't 
had to do, though others have.  Check archives of this list as well as 
Paul Johnson's home page.

jimk



                
---------------------------------
Yahoo! for Good - Make a difference this year. 

Reply via email to