in reply to Testing Perl Package

I gone thorugh the module, but i am unable to check with my package

Show your work? Have you read perlintro and Test::Tutorial - A tutorial about writing really basic tests?

Use http://search.cpan.org/perldoc/Test::More#is_deeply?

Replies are listed 'Best First'.
Re^2: Testing Perl Package
by Anonymous Monk on May 10, 2013 at 08:46 UTC

    I have gone through the modules which mentioned, still i am unable to proceed with my package to test with "Test::more" module

    How to start the testing with my package

      I think the first step would be for you to make statements about what your package is supposed to be or do.

      An example could be the statement "The module compiles".

      A better example would be statements on the meaning of the data in your module. Maybe "Every machine has a positive number of CAN_NETWORK_INTERFACES".

      The second step is then to write programs that check that these statements are true. This is where Test::Tutorial comes in.

      With which of the two steps do you have problems? What are these problems?

        Hi,

        Thanks for the comments.

        i am testing the package with the Test::more module, see the below code,

        #!/usr/bin/perl -w use strict; use SptTgtCfg; use Test::More; BEGIN { use_ok('SptTgtCfg'); } $SptTgtCfg = SptTgtCfg::Max_Num_Of_Interest_Mask->new(CAN11 => 4,C +AN29 => 4); ok( defined $SptTgtCfg, 'new() returened something' ); ok( $SptTgtCfg->isa('SptTgtCfg'), " and it's the right class" ); is( $SptTgtCfg->CAN11, 7, ' CAN11()' ); is( $SptTgtCfg->CAN29, 2, ' CAN29)' );

        whether i am doing correct or not, please suggest. If i run this code, i am getting error as

        1. ok 1 - use SptTgtCfg;

        2. Gllobal symbol requires explicit package name

      You probably should not.

        hi,

        i updated the code package with funtion, how to validate that function

        or Please help me to get idea with some simple examples other than mentioned in the site