File Coverage

blib/lib/Test/Run/Plugin/BreakOnFailure.pm
Criterion Covered Total %
statement 20 20 100.0
branch 2 2 100.0
condition 2 3 66.6
subroutine 6 6 100.0
pod n/a
total 30 31 96.7


line stmt bran cond sub pod time code
1             package Test::Run::Plugin::BreakOnFailure;
2              
3 2     2   1174477 use warnings;
  2         5  
  2         62  
4 2     2   10 use strict;
  2         4  
  2         37  
5              
6 2     2   43 use 5.008;
  2         10  
7              
8 2     2   374 use MRO::Compat;
  2         1193  
  2         29  
9              
10 2     2   446 use Moose;
  2         389875  
  2         13  
11              
12             =head1 NAME
13              
14             Test::Run::Plugin::BreakOnFailure - stop processing the entire test suite
15             upon the first failure.
16              
17             =head1 VERSION
18              
19             Version 0.0.5
20              
21             =cut
22              
23             our $VERSION = '0.0.5';
24              
25             extends('Test::Run::Base');
26              
27             has 'should_break_on_failure' => (isa => "Bool", is => "rw",);
28              
29             =head1 SYNOPSIS
30              
31             package MyTestRun;
32              
33             use Moose
34              
35             extends(qw(Test::Run::Plugin::BreakOnFailure Test::Run::Obj);
36              
37             =head1 FUNCTIONS
38              
39             =head2 $self->should_break_on_failure()
40              
41             A boolean flag that determines if the test suite should break after the
42             first failing test.
43              
44             =cut
45              
46             sub _run_all_tests_loop
47             {
48 2     2   120734 my $self = shift;
49              
50             TEST_FILES_LOOP:
51 2         6 foreach my $test_file_path (@{$self->test_files()})
  2         42  
52             {
53 3         35 $self->_run_single_test({ test_file => $test_file_path});
54              
55 3 100 66     445693 if ($self->should_break_on_failure()
56             && (!$self->last_test_results->passing())
57             )
58             {
59 1         49 last TEST_FILES_LOOP;
60             }
61             }
62             }
63              
64             =head1 AUTHOR
65              
66             Shlomi Fish, L<http://www.shlomifish.org/> .
67              
68             =head1 BUGS
69              
70             Please report any bugs or feature requests to
71             C<bug-test-run-plugin-alternateinterpreters at rt.cpan.org>, or through the web interface at
72             L<http://rt.cpan.org/NoAuth/ReportBug.html?Queue=Test::Run::Plugin::BreakOnFailure>.
73             I will be notified, and then you'll automatically be notified of progress on
74             your bug as I make changes.
75              
76             =head1 SUPPORT
77              
78             You can find documentation for this module with the perldoc command.
79              
80             perldoc Test::Run::Plugin::BreakOnFailure
81              
82             You can also look for information at:
83              
84             =over 4
85              
86             =item * AnnoCPAN: Annotated CPAN documentation
87              
88             L<http://annocpan.org/dist/Test::Run::Plugin::BreakOnFailure>
89              
90             =item * CPAN Ratings
91              
92             L<http://cpanratings.perl.org/d/Test::Run::Plugin::BreakOnFailure>
93              
94             =item * RT: CPAN's request tracker
95              
96             L<http://rt.cpan.org/NoAuth/Bugs.html?Dist=Test::Run::Plugin::BreakOnFailure>
97              
98             =item * MetaCPAN
99              
100             L<https://metacpan.org/release/Test-Run-Plugin-BreakOnFailure>
101              
102             =back
103              
104             =head1 ACKNOWLEDGEMENTS
105              
106             I came up with the idea for this plugin for use for working for my work
107             for Reask ( L<http://reask.com/> ).
108              
109             =head1 SEE ALSO
110              
111             L<Test::Run>, L<Test::Run::CmdLine>, L<TAP::Parser>
112              
113             =head1 COPYRIGHT & LICENSE
114              
115             Copyright 2010 Shlomi Fish.
116              
117             This program is distributed under the MIT (X11) License:
118             L<http://www.opensource.org/licenses/mit-license.php>
119              
120             Permission is hereby granted, free of charge, to any person
121             obtaining a copy of this software and associated documentation
122             files (the "Software"), to deal in the Software without
123             restriction, including without limitation the rights to use,
124             copy, modify, merge, publish, distribute, sublicense, and/or sell
125             copies of the Software, and to permit persons to whom the
126             Software is furnished to do so, subject to the following
127             conditions:
128              
129             The above copyright notice and this permission notice shall be
130             included in all copies or substantial portions of the Software.
131              
132             =cut
133              
134             1; # End of Test::Run::Plugin::BreakOnFailure