Bamboo/Session.pm

filter: Statementstmt 23.0% 9 / 39 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 18.0% 13 / 72 CC 10 SCAR 37.0
CC
10
Cov
15%
_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 has '_output' => (
10 is => 'rw',
11 isa => 'Str',
12 default => '',
13 );
14  
15 0 ▶sub _initialize {
Subroutine _initialize: not called CC=2 SCAR=17.9
16 0 my ($self, $arg_for) = @_;
17 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
18  
19 0 return $self->SUPER::_initialize($arg_for);
20 }
21  
22 0 ▶sub result {
Subroutine result: not called CC=1 SCAR=6.9
Pod documented
23 0 my ($self, $result) = @_;
24 0 $self->_output( $self->_output . $result->raw() . "\n" );
25 }
26  
27 0 ▶sub close_test {
Subroutine close_test: not called CC=2 SCAR=17.9
Pod documented
28 0 my $self = shift;
29 0 my $parser = $self->parser;
30  
31 0 my $results = {
32 description => $self->name,
33 start_time => $parser->start_time,
34 end_time => $parser->end_time,
35 tests_run => $parser->tests_run,
36 failed => scalar($parser->failed),
37 parse_errors => scalar($parser->parse_errors),
38 output => $self->_output,
39 };
40  
41 0 my @fail_reasons = _fail_reasons($parser);
42 0 ▶ if(@fail_reasons) {
Branch: 1 branch
BranchTrueFalseTotal
if (@fail_reasons) { } 0 0 0
43 0 $results->{fail_reasons} = \@fail_reasons;
44 print STDERR "FAIL " . $self->name . "\n" .
45 0 join("", map { " $_\n" } @fail_reasons);
46 }
47 else {
48 0 print { $self->formatter->stdout } "PASS " . $self->name . "\n";
49 }
50  
51 0 push(@{$self->formatter->_test_results}, $results);
52 }
53  
54 0 ▶sub _fail_reasons {
Subroutine _fail_reasons: not called CC=8 SCAR=42.8
55 0 my( $parser ) = @_;
56  
57 0 my @reasons = ();
58 0 ▶ if( $parser->failed ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($parser->failed) 0 0 0
59 0 push(@reasons, "failed tests (" . join( ', ', $parser->failed ) . ")");
60 }
61 0 ▶ if( $parser->todo_passed ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($parser->todo_passed) 0 0 0
62 0 push(@reasons, "unexpected TODO passed (" . join( ', ', $parser->todo_passed ) . ")");
63 }
64 0 ▶ if( $parser->parse_errors ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($parser->parse_errors) 0 0 0
65 0 push(@reasons, "parse errors (" . join( ', ', $parser->parse_errors ) . ")");
66 }
67 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
68 0 push(@reasons, "non-zero exit code (" . $parser->exit . ")");
69 }
70  
71 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
72 0 push(@reasons, "unknown reason (probably some bug encountered)");
73 }
74  
75 0 return @reasons;
76 }
77  
78 1 1;
↑ Summary Bamboo.pm »