Bamboo/Session.pm

filter: Statementstmt 25.0% 10 / 40 Branchbran 0.0% 0 / 12 Conditioncond 0.0% 0 / 8 MC/DCmcdc 0.0% 0 / 5 Subroutinesub 33.3% 2 / 6 Podpod 100% 2 / 2 totaltotal 19.1% 14 / 73 CC 10 SCAR 37.0
CC
10
Cov
17%
_fail_reasons
72.0
_initialize
6.0
close_test
6.0
CRAP 40.3
↑ Summary Bamboo.pm »
1 package TAP::Formatter::Bamboo::Session;
2  
3 1 ▶use Moose;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 1 ▶use MooseX::NonMoose;
Subroutine BEGIN: called CC=1 SCAR=0.0
5 1 extends qw(
6 TAP::Formatter::Console::Session
7 );
8  
9 1 our $VERSION = '0.04_03';
10  
11 1 has '_output' => (
12 is => 'rw',
13 isa => 'Str',
14 default => '',
15 );
16  
17 0 ▶sub _initialize {
Subroutine _initialize: not called CC=2 SCAR=17.9
18 0 my ($self, $arg_for) = @_;
19 0 ▶ $arg_for ||= {};
Condition0%0/2
$arg_for ||= {}
l!l
00
MC/DC0%0/1
$arg_for ||= {}
$arg_for
Truth table0%0/2
A
A= $arg_for
Aresult
11
00
20  
21 0 return $self->SUPER::_initialize($arg_for);
22 }
23  
24 0 ▶sub result {
Subroutine result: not called CC=1 SCAR=6.9
Pod documented
25 0 my ($self, $result) = @_;
26 0 $self->_output( $self->_output . $result->raw() . "\n" );
27 }
28  
29 0 ▶sub close_test {
Subroutine close_test: not called CC=2 SCAR=17.9
Pod documented
30 0 my $self = shift;
31 0 my $parser = $self->parser;
32  
33 0 my $results = {
34 description => $self->name,
35 start_time => $parser->start_time,
36 end_time => $parser->end_time,
37 tests_run => $parser->tests_run,
38 failed => scalar($parser->failed),
39 parse_errors => scalar($parser->parse_errors),
40 output => $self->_output,
41 };
42  
43 0 my @fail_reasons = _fail_reasons($parser);
44 0 ▶ if(@fail_reasons) {
Branch: 1 branch
BranchTrueFalseTotal
if (@fail_reasons) { } 0 0 0
45 0 $results->{fail_reasons} = \@fail_reasons;
46 print STDERR "FAIL " . $self->name . "\n" .
47 0 join("", map { " $_\n" } @fail_reasons);
48 }
49 else {
50 0 print { $self->formatter->stdout } "PASS " . $self->name . "\n";
51 }
52  
53 0 push(@{$self->formatter->_test_results}, $results);
54 }
55  
56 0 ▶sub _fail_reasons {
Subroutine _fail_reasons: not called CC=8 SCAR=42.8
57 0 my( $parser ) = @_;
58  
59 0 my @reasons = ();
60 0 ▶ if( $parser->failed ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($parser->failed) 0 0 0
61 0 push(@reasons, "failed tests (" . join( ', ', $parser->failed ) . ")");
62 }
63 0 ▶ if( $parser->todo_passed ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($parser->todo_passed) 0 0 0
64 0 push(@reasons, "unexpected TODO passed (" . join( ', ', $parser->todo_passed ) . ")");
65 }
66 0 ▶ if( $parser->parse_errors ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($parser->parse_errors) 0 0 0
67 0 push(@reasons, "parse errors (" . join( ', ', $parser->parse_errors ) . ")");
68 }
69 0 ▶ if( !@reasons && $parser->exit != 0) {
Branch: 1 branch
BranchTrueFalseTotal
if (not @reasons and $parser->exit != 0) 0 0 0
Condition0%0/3
not @reasons and $parser->exit != 0
!ll&&!rl&&r
000
MC/DC0%0/2
not @reasons and $parser->exit != 0
not @reasons $parser->exit != 0
Truth table0%0/3
not(A) and B
A= not @reasonsB= $parser->exit != 0
ABresult
0X0
100
111
70 0 push(@reasons, "non-zero exit code (" . $parser->exit . ")");
71 }
72  
73 0 ▶ if( !@reasons && $parser->has_problems ) {
Branch: 1 branch
BranchTrueFalseTotal
if (not @reasons and $parser->has_problems) 0 0 0
Condition0%0/3
not @reasons and $parser->has_problems
!ll&&!rl&&r
000
MC/DC0%0/2
not @reasons and $parser->has_problems
not @reasons $parser->has_problems
Truth table0%0/3
not(A) and B
A= not @reasonsB= $parser->has_problems
ABresult
0X0
100
111
74 0 push(@reasons, "unknown reason (probably some bug encountered)");
75 }
76  
77 0 return @reasons;
78 }
79  
80 1 1;
↑ Summary Bamboo.pm »