Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Test::Class simple example

  • Test::Class

  • Test::Class

  • use the Test attribute to mark a function as test

package t::lib::MyApp;
use strict;
use warnings;

use base 'Test::Class';
use Test::More;

use MyApp qw(add);

sub test_add : Test {
    is add(2, 3), 5;
}

1;
use strict;
use warnings;

use lib '.';
use t::lib::MyApp;
Test::Class->runtests;