Perl Testing: How to stop testing in a single file after first failure -
i'm using test::more module. if have .t file bunch of tests (mainly using ok()); how can make testcase stop after first failure. i'm seeing right if first ok fails; subsequent ok() cases still being run.
i looked @ using test::more::bail_out; stop testing stop (meaning other .t files have) rather testing stop particular file.
thanks!
call done_testing()
, exit
.
ok( first_test(), 'first test' ) or done_testing, exit; ok( second_test(), 'second test' ); ...
in other cases, can use skip
function inside block skip
label.
skip: { ok( first_test ) or skip "useless run next 4 tests", 4; ok( second_test ); ok( third_test ); ok( fourth_test ); ok( fifth_test ); } ok( sixth_test ); done_testing();
the main advantage of skip/skip
is supported in older versions of test::more
.
Comments
Post a Comment