File Coverage

blib/lib/Test/Run/Plugin/BreakOnFailure.pm
Criterion Covered Total %
statement 13 15 86.6
branch n/a
condition n/a
subroutine 5 5 100.0
pod n/a
total 18 20 90.0


line stmt bran cond sub pod time code
1             package Test::Run::Plugin::BreakOnFailure;
2              
3 1     1   32051 use warnings;
  1         2  
  1         32  
4 1     1   5 use strict;
  1         3  
  1         32  
5              
6 1     1   20 use 5.008;
  1         7  
  1         32  
7              
8 1     1   1005 use MRO::Compat;
  1         3408  
  1         25  
9              
10 1     1   471 use Moose;
  0            
  0            
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.4
20              
21             =cut
22              
23             our $VERSION = '0.0.4';
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             my $self = shift;
49              
50             TEST_FILES_LOOP:
51             foreach my $test_file_path (@{$self->test_files()})
52             {
53             $self->_run_single_test({ test_file => $test_file_path});
54              
55             if ($self->should_break_on_failure()
56             && (!$self->last_test_results->passing())
57             )
58             {
59             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 * Search CPAN
99              
100             L<http://search.cpan.org/dist/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