Sherzod Ruzmetov > Class-PObject > Class::PObject::Test

Download:
Class-PObject-2.17.tar.gz

Dependencies

Annotate this POD

CPAN RT

New  3
Open  0
View/Report Bugs
Module Version: 1.02   Source  

NAME ^

Class::PObject::Test - Base test framework for Class::PObject drivers

SYNOPSIS ^

    package Class::PObject::Test::MyTest;
    require Class::PObject::Test;
    @ISA = ('Class::PObject::Test');

    sub run {
        my $self = shift;

        my $driver      = $self->{driver};
        my $datasource  = $self->{datasource};

        # perform your tests using $driver and $datasource

    }

ABSTRACT ^

    Class::PObject::Test is a base testing framework for Class::PObject drivers.

DESCRIPTION ^

Class::PObject::Test is used as a base class by test libraries, and provides two methods, new() and run(). Subclasses of Class::PObject::Test are expected to override run().

IS THIS WAY OF TESTING NECESSARY

Same sets of tests must be performed for every single driver available to ensure all the drivers are compatible. That's why, instead of putting redundant chunks of codes in multiple t/*.t files, we created a library, which can run same tests for different drivers.

For example, to run some basic/core tests on file driver, we do:

    # t/01basic_file.t
    use Class::PObject::Test::Basic;
    $t = new Class::PObject::Test::Basic('file', './data');
    $t->run()

To run these same set of tests for mysql driver, for example, we can do:

    # t/02basic_mysql.t
    use Class::PObject::Test::Basic;
    $t = new Class::PObject::Test::Basic('mysql', {Handle=>$dbh});
    $t->run()

and so on.

This will ensure that same exact tests are run for every driver.

METHODS ^

SEE ALSO ^

Class::PObject::Test::Basic

COPYRIGHT AND LICENSE ^

For author and copyright information refer to Class::PObject's online manual.

syntax highlighting: