Softpedia
 


LINUX CATEGORIES:



GLOBAL PAGES >>
NEWS ARCHIVE >>
SOFTPEDIA REVIEWS >>
MEET THE EDITORS >>
WEEK'S BEST
  • Linux Kernel 3.9.2 / 3....
  • LibreOffice 3.6.6 / 4.0.3
  • MPlayer 1.1.1
  • systemd 204
  • Arch Linux 2013.05.01
  • Blender 2.67
  • KDE Software Compilatio...
  • CrunchBang Linux Stable...
  • Elementary OS 0.1 / 0.2...
  • SystemRescueCd 3.6.0
  • Home > Linux > Programming > Perl Modules

    Test::Class 0.36

    Download button

    No screenshots available
    Downloads: 322  View global page NEW!  Tell us about an update
    User Rating:
    Rated by:
    Good (3.6/5)
    15 user(s)
    Developer:

    License / Price:

    Last Updated:

    Category:
    Adrian Howard | More programs
    Perl Artistic License / FREE
    April 7th, 2008, 14:10 GMT
    ROOT / Programming / Perl Modules

     Read user reviews (0)  Refer to a friend  Subscribe

    Test::Class description

    A Perl module that allows you to easily create test classes in an xUnit/JUnit style.

    Test::Class is a Perl module that allows you to easily create test classes in an xUnit/JUnit style.

    SYNOPSIS

    package Example::Test;
    use base qw(Test::Class);
    use Test::More;

    # setup methods are run before every test method.
    sub make_fixture : Test(setup) {
    my $array = [1, 2];
    shift->{test_array} = $array;
    };

    # a test method that runs 1 test
    sub test_push : Test {
    my $array = shift->{test_array};
    push @$array, 3;
    is_deeply($array, [1, 2, 3], 'push worked');
    };

    # a test method that runs 4 tests
    sub test_pop : Test(4) {
    my $array = shift->{test_array};
    is(pop @$array, 2, 'pop = 2');
    is(pop @$array, 1, 'pop = 1');
    is_deeply($array, [], 'array empty');
    is(pop @$array, undef, 'pop = undef');
    };

    # teardown methods are run after every test method.
    sub teardown : Test(teardown) {
    my $array = shift->{test_array};
    diag("array = (@$array) after test(s)");
    };
    later in a nearby .t file
    #! /usr/bin/perl
    use Example::Test;

    # run all the test methods in Example::Test
    Test::Class->runtests;

    Outputs:

    1..5
    ok 1 - pop = 2
    ok 2 - pop = 1
    ok 3 - array empty
    ok 4 - pop = undef
    # array = () after test(s)
    ok 5 - push worked
    # array = (1 2 3) after test(s)

    Product's homepage

    Requirements:

    · Perl

      


    TAGS:

    create classes | xUnit style | JUnit style | Test | testing | classes

    Go to top

    WindowsGamesDriversMacLinuxScriptsMobileHandheldNews

    SUBMIT PROGRAM   |   ADVERTISE   |   GET HELP   |   SEND US FEEDBACK   |   RSS FEEDS   |   UPDATE YOUR SOFTWARE   |   ROMANIAN FORUM