package Test::Run::Plugin::BreakOnFailure; use warnings; use strict; use MRO::Compat; use Moose; =head1 NAME Test::Run::Plugin::BreakOnFailure - stop processing the entire test suite upon the first failure. =head1 VERSION Version 0.0.2 =cut our $VERSION = '0.0.2'; extends('Test::Run::Base'); has 'should_break_on_failure' => (isa => "Bool", is => "rw",); =head1 SYNOPSIS package MyTestRun; use Moose extends(qw(Test::Run::Plugin::BreakOnFailure Test::Run::Obj); =head1 FUNCTIONS =head2 $self->should_break_on_failure() A boolean flag that determines if the test suite should break after the first failing test. =cut sub _run_all_tests_loop { my $self = shift; TEST_FILES_LOOP: foreach my $test_file_path (@{$self->test_files()}) { $self->_run_single_test({ test_file => $test_file_path}); if ($self->should_break_on_failure() && (!$self->last_test_results->passing()) ) { last TEST_FILES_LOOP; } } } =head1 AUTHOR Shlomi Fish, L . =head1 BUGS Please report any bugs or feature requests to C, or through the web interface at L. I will be notified, and then you'll automatically be notified of progress on your bug as I make changes. =head1 SUPPORT You can find documentation for this module with the perldoc command. perldoc Test::Run::Plugin::BreakOnFailure You can also look for information at: =over 4 =item * AnnoCPAN: Annotated CPAN documentation L =item * CPAN Ratings L =item * RT: CPAN's request tracker L =item * Search CPAN L =back =head1 ACKNOWLEDGEMENTS I came up with the idea for this plugin for use for working for my work for Reask ( L ). =head1 SEE ALSO L, L, L =head1 COPYRIGHT & LICENSE Copyright 2010 Shlomi Fish. This program is distributed under the MIT (X11) License: L Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. =cut 1; # End of Test::Run::Plugin::BreakOnFailure