Help for this page

Select Code to Download


  1. or download this
    sub pre_test : Test(setup) {
        # add objects to the database
    }
    ...
    sub post_test : Test(teardown) {
        # clean the database
    }
    
  2. or download this
    package TestBase;
    
    use base 'Test::Class';
    ...
    INIT { Test::Class->runtests }
    
    1;
    
  3. or download this
    package Foo;
    
    use Test::More;
    ...
    }
    
    1;
    
  4. or download this
    package Bar;
    
    use Test::More;
    ...
    }
    
    1;
    
  5. or download this
    1..8
    ok 1 - Bar: should be called second
    ok 2 - Let's hope this isn't dependent on Foo's setup method
    ...
    ok
    All tests successful.
    Files=1, Tests=8,  0 wallclock secs ( 0.11 cusr +  0.02 csys =  0.12 C
    +PU)
    
  6. or download this
    sub setup : Tests(setup => 1) {
        my $test = shift;
        $test->SUPER::setup;
        ok 1, 'Bar: should be called second';
    }