Test::Classy

Write your unit tests in other modules than *.t
Download

Test::Classy Ranking & Summary

Advertisement

  • Rating:
  • License:
  • Perl Artistic License
  • Price:
  • FREE
  • Publisher Name:
  • Kenichi Ishigaki
  • Publisher web site:
  • http://search.cpan.org/~ishigaki/Test-UseAllModules-0.09/lib/Test/UseAllModules.pm

Test::Classy Tags


Test::Classy Description

Write your unit tests in other modules than *.t Test::Classy is a Perl module to write your unit tests in other modules than *.t.SYNOPSISin your test file (t/some_test.t): use lib 't/lib'; use Test::Classy; use MyApp::Model::DB; # prepare things you want to use in the tests (if you prefer) my $db = MyApp::Model::DB->connect; # load every test packages found under MyApp::Test:: load_tests_from 'MyApp::Test'; # or load it explicitly load_test 'MyApp::OtherTest::ForSomething'; # you can limit tests only with Model attribute limit_tests_by 'Model'; # run each of the tests ($db will be passed as an argument) # usually you don't need to declare plan of the tests here. run_tests( $db ); # let's do some cleanings END { $db->disconnect; }in your unit test class: package MyApp::Test::Something; use Test::Classy::Base; # write 'Test' attribute to test sub for_some : Test { my ($class, @args) = @_; # some unit test ok 1, "you can use Test::More's functions by default"; } # you can declare the number of tests in a unit sub for_others : Tests(2) { my ($class, @args) = @_; pass 'first'; pass 'second'; } # tests will be skipped with 'Skip' attribute sub yet_another : Tests(2) Skip(for some reason) { my ($class, @args) = @_; pass 'but this test will be skipped'; fail 'but this test will be skipped, either'; } # TODO should work as you expect, too. sub may_fail : Tests TODO(for some reason) { my ($class, @args) = @_; fail 'until something is implemented'; } # you can add any attributes to limit sub test_for_model : Test Model { my ($class, @args) = @_; # you can use $class->test_name to show the name of the test pass $class->test_name; # "test_for_model" } Requirements: · Perl


Test::Classy Related Software