Test::Group

Test::Group - Group together related tests in a test suite
Download

Test::Group Ranking & Summary

Advertisement

  • Rating:
  • License:
  • Perl Artistic License
  • Price:
  • FREE
  • Publisher Name:
  • Dominique Quatravaux and Nicolas M. ThiĆ©ry
  • Publisher web site:
  • http://search.cpan.org/~domq/

Test::Group Tags


Test::Group Description

Test::Group - Group together related tests in a test suite Test::Group is a Perl module to group together related tests in a test suite.SYNOPSIS use Test::More no_plan => 1; use Test::Group; test "hammering the server" => sub { ok(I_can_connect); for(1..1000) { ok(I_can_make_a_request); } }; # Don't forget the semicolon here! test "this test group will fail", sub { ok 1, "sub test blah"; is "foo", "bar"; # Oops! ok 1; like "blah blah blah", qr/bla/; }; test "this test will fail but the suite will proceed", sub { pass; die; }; test "a test with TODO in the name is marked TODO" => sub { pass("this part is done"); fail("but I'm not finished with this one yet"); }; { local $TODO = "Test::More's good old method also works"; test "this test is not finished yet" => sub { pass; fail; }; }; # Don't catch exceptions raised in test groups later on Test::Group->dont_catch_exceptions; # log caught exceptions in /tmp/log Test::Group->logfile("/tmp/log"); # skip the next group of test skip_next_test "network not available" if (! Network->available()); test "bla", sub { my $ftp = Net::FTP->new("some.host.name"); # ... }; begin_skipping_tests "reason"; test "this test will not run" => sub { # ... }; end_skipping_tests; # from now on, skip all tests whose names do not match /bla/ test_only qr/bla/;Fed up with counting tests to discover what went wrong in your last test run? Tired of squinting at your test source to find out where on earth the faulty test predicate is called, and what it is supposed to check for? Then this module is for you!Test::Group allows for grouping together related tests in a standard Test::More-style script. (If you are not already familiar with Test::More, now would be the time to go take a look.) Test::Group provides a bunch of maintainability and scalability advantages to large test suites: * related tests can be grouped and given a name. The intent of the test author is therefore made explicit with much less effort than would be needed to name all the individual tests; * the test output is much shorter and more readable: only failed subtests show a diagnostic, while test groups with no problems inside produce a single friendly ok line; * no more tedious test counting: running an arbitrarily large or variable number of tests (e.g. in loops) is now hassle-free and doesn't clutter the test output.Authors of Test::* modules may also find Test::Group of interest, because it allows for composing several Test::More predicates into a single one (see "Reflexivity"). Requirements: · Perl


Test::Group Related Software