TB2::DieOnFail - Stop the test on the first failure
use TB2::DieOnFail; use Test::Simple tests => 3; ok(1); ok(0); # here it will stop ok(1);
A demonstration of writing an EventHandler using handle_result to kill the test when an assert fails.
handle_result
While this will work with Test::Builder based modules (for example, Test::More still uses Test::Builder) it will kill the test before any diagnostics are output. Test::Builder2 based modules (such as Test::Simple) do not have this problem.
TB2::EventHandler
To install Test::Simple, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Test::Simple
CPAN shell
perl -MCPAN -e shell install Test::Simple
For more information on module installation, please visit the detailed CPAN module installation guide.