How to Assess code coverage of both perl scripts and modules

How to Assess code coverage of both perl scripts and modules

am 23.12.2009 17:47:12 von narendra dhulipalla

--===============1940135038==
Content-Type: multipart/alternative; boundary=0016e644cd96fb37ce047b681285

--0016e644cd96fb37ce047b681285
Content-Type: text/plain; charset=ISO-8859-1

Hi,

I have unique requirement of handling code coverage of my perl scripts.

I have written few perl scripts which inturn uses few perl modules. My
requirement is to use run these perl scripts with different options they
support and asses the code coverage of both perl scripts perl modules.

So I am using *Devel::Cover, Module::Build and Test::More* from CPAN. Its
all woring fine if I call functions inside perl modules directly inside test
script. But its not working if I call the scripts directly (In this case I
am not getting generated with code coverage of perl modules and scripts
both).

Here is my example test script using Test::More:

use strict;
use warnings;
use Test::More;

BEGIN { plan tests => 1 }

# Expected Failure: Incorrect IP address
ok(sub {
my @args = ("*ex4200fw*","-query-fw","-i","192.168.168.1");
#print "# Executing @args \n";
`@args`;
my $rc = $? >> 8;
#print "# Return code: $rc \n";
$rc == 1
}->(),"Query Juniper EX4200 FW, incorrect IP address.\n");

Here ex4200fw (is in path) is the perl script written by me which inturn
calls dependant module updates.pm

Do we have any tools to suite to this requirement? (like running perl
scripts and getting code coverage of both scripts and its dependant
modules)?
Can we accomplish the same using above CPAN modules? Any sample script is
much useful for me.

Thanks in Advance.
Naren.

--
Thanks and Regards
Narendra Dhulipalla
Success is not final, failure is not fatal: it is the courage to continue
that counts. --- Winston Churchill
(9986164688)

--0016e644cd96fb37ce047b681285
Content-Type: text/html; charset=ISO-8859-1
Content-Transfer-Encoding: quoted-printable

Hi,

I have unique requirement of handling code coverage of my perl s=
cripts.

I have written few perl scripts which inturn uses few perl m=
odules. My requirement is to use run these perl scripts with different opti=
ons they support and asses the code coverage of both perl scripts perl modu=
les.


So I am using Devel::Cover, Module::Build and Test::More from CP=
AN. Its all woring fine if I call functions inside perl modules directly in=
side test script. But its not working if I call the scripts directly (In th=
is case I am not getting generated with code coverage of perl modules and s=
cripts both).


Here is my example test script using Test::More:

use strict;
=
use warnings;
use Test::More;

BEGIN { plan tests =3D> 1 }
<=
br># Expected Failure: Incorrect IP address
ok(sub {
   my @args =
=3D ("ex4200fw","-query-fw","-i","=
;192.168.168.1");

   #print "# Executing @args \n";
   `@args`;
=A0=
=A0 my $rc =3D $? >> 8;
   #print "# Return code: $rc \n&=
quot;;
   $rc == 1
}->(),"Query Juniper EX4200 FW, in=
correct IP address.\n");


Here ex4200fw (is in path) is the perl script written by me which intur=
n calls dependant module
<=
br>Do we have any tools to suite to this requirement? (like running perl sc=
ripts and getting code coverage of both scripts and its dependant modules)?=


Can we accomplish the same using above CPAN modules? Any sample script is m=
uch useful for me.

Thanks in Advance.
Naren.

--
Thanks=
and Regards
Narendra Dhulipalla
Success is not final, failure is not=
fatal: it is the courage to continue that counts. --- Winston Churchill r>
(9986164688)


--0016e644cd96fb37ce047b681285--

--===============1940135038==
Content-Type: text/plain; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Content-Disposition: inline

_______________________________________________
ActivePerl mailing list
ActivePerl@listserv.ActiveState.com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
--===============1940135038==--