moot has asked for the wisdom of the Perl Monks concerning the following question:

Howdy!

I just started using Test::Unit to write some tests for refactored code, however I can't seem to find any way to skip tests a la Test::More's skip() function. Anyone know if this is possible? I'm probably overlooking something simple..

Replies are listed 'Best First'.
Re: Skipping Test::Unit::TestCase tests
by adrianh (Chancellor) on Apr 26, 2005 at 08:43 UTC
    I just started using Test::Unit to write some tests for refactored code

    If you've only just started using Test::Unit may I suggest (with only a little bit of authorial bias ;-) that you stop - and use Test::Class instead, which supports skipped tests.

    AFAIK Test::Unit doesn't support skipped tests and is no longer being actively developed.

      Thanks, I'll give it a look.
Re: Skipping Test::Unit::TestCase tests
by InfiniteLoop (Hermit) on Apr 25, 2005 at 18:49 UTC
    How are you using the skip() function ? The correct way to do it (as the document says) is to wrap your tests with a SKIP: {}; block, like this:
    SKIP: { skip $why, $how_many unless $have_some_feature; ok( foo(), $test_name ); is( foo(42), 23, $test_name ); };
      Which would work fine, except there is no skip() function in Test::Unit::TestCase.
      $ ( perldoc -m Test::Unit ; perldoc -m Test::Unit::TestCase ; \ perldoc -m Test::Unit::TestSuite; perldoc -m Test::Unit::Runner; \ perldoc -m Test::Unit::Assert ; perldoc -m Test::Unit::Tutorial ; \ perldoc -m Test::Unit::Test ; perldoc -m Test::Unit::Loader ) \ | grep -i skip debug(sprintf "skipping %s\n", $t->name()); $