lib/WWW/Mechanize/Script/Plugin/ResponseTimeTest.pm

filter: Statementstmt 42.4% 14 / 33 Branchbran 0.0% 0 / 8 Conditioncond 0.0% 0 / 10 MC/DCmcdc 0.0% 0 / 6 Subroutinesub 83.3% 5 / 6 Podpod 100% 2 / 2 totaltotal 32.3% 21 / 65 CC 9 SCAR 40.6
CC
9
Cov
27%
check_response
90.0
BEGIN
1.0
BEGIN
1.0
CRAP 58.2
« lib/Config/Any/WTScript.pm ↑ Summary lib/WWW/Mechanize/Script/Plugin/RegexMatchTest.pm »
1 package WWW::Mechanize::Script::Plugin::ResponseTimeTest;
2  
3 2 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 2 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
5  
6 2 ▶use parent qw(WWW::Mechanize::Script::Plugin);
Subroutine BEGIN: called CC=1 SCAR=0.0
7  
8 # ABSTRACT: check response time of request
9  
10 2 our $VERSION = '0.100';
11  
12 2 ▶use 5.014;
Subroutine BEGIN: called CC=1 SCAR=0.0
13  
14  
15 sub check_value_names
16 5 ▶{
Subroutine check_value_names: called CC=1 SCAR=0.0
Pod documented
17 5 return qw(min_elapsed_time max_elapsed_time);
18 }
19  
20  
21 sub check_response
22 0 ▶{
Subroutine check_response: not called CC=9 SCAR=45.0
Pod documented
23 0 my ( $self, $check, $mech ) = @_;
24  
25 0 my $code = 0;
26 0 my $msg;
27  
28 0 my $min_time = 0 + $self->get_check_value( $check, "min_elapsed_time" );
29 0 my $max_time = 0 + $self->get_check_value( $check, "max_elapsed_time" );
30 0 my $total_time = 0 + $mech->client_elapsed_time();
31  
32 0 ▶ if ( defined($min_time) and $min_time > $total_time )
Branch: 1 branch
BranchTrueFalseTotal
if (defined $min_time and $min_time > $total_time) 0 0 0
Condition0%0/3
defined $min_time and $min_time > $total_time
!ll&&!rl&&r
000
MC/DC0%0/2
defined $min_time and $min_time > $total_time
defined $min_time $min_time > $total_time
Truth table0%0/3
A and B
A= defined $min_timeB= $min_time > $total_time
ABresult
0X0
100
111
33 {
34 0 ▶ my $err_code = $self->get_check_value( $check, "min_elapsed_time_code" ) // 1;
Condition0%0/2
$self->get_check_value($check, "min_elapsed_time_code") // 1
l!l
00
MC/DC0%0/1
$self->get_check_value($check, "min_elapsed_time_code") // 1
$self->get_check_value($check, "min_elapsed_time_code")
Truth table0%0/2
A
A= $self->get_check_value($check, "min_elapsed_time_code")
Aresult
11
00
35 0 $code = &{ $check->{compute_code} }( $code, $err_code );
36 0 $msg = "elapsed time $total_time exceeded lower threshold ($min_time)";
37 }
38 0 ▶ if ( defined($max_time) and $max_time < $total_time )
Branch: 1 branch
BranchTrueFalseTotal
if (defined $max_time and $max_time < $total_time) 0 0 0
Condition0%0/3
defined $max_time and $max_time < $total_time
!ll&&!rl&&r
000
MC/DC0%0/2
defined $max_time and $max_time < $total_time
defined $max_time $max_time < $total_time
Truth table0%0/3
A and B
A= defined $max_timeB= $max_time < $total_time
ABresult
0X0
100
111
39 {
40 0 ▶ my $err_code = $self->get_check_value( $check, "max_elapsed_time_code" ) // 1;
Condition0%0/2
$self->get_check_value($check, "max_elapsed_time_code") // 1
l!l
00
MC/DC0%0/1
$self->get_check_value($check, "max_elapsed_time_code") // 1
$self->get_check_value($check, "max_elapsed_time_code")
Truth table0%0/2
A
A= $self->get_check_value($check, "max_elapsed_time_code")
Aresult
11
00
41 0 $code = &{ $check->{compute_code} }( $code, $err_code );
42 0 ▶ if ($msg)
Branch: 1 branch
BranchTrueFalseTotal
if ($msg) { } 0 0 0
43 {
44 0 $msg .= " and upper threshold ($max_time)";
45 }
46 else
47 {
48 0 $msg = "elapsed time $total_time exceeded upper threshold ($max_time)";
49 }
50 }
51  
52 0 ▶ return ( $code, ( $msg ? ($msg) : () ) );
Branch: 1 branch
BranchTrueFalseTotal
$msg ? : 0 0 0
53 }
54  
55 2 1;
56  
57 __END__
« lib/Config/Any/WTScript.pm ↑ Summary lib/WWW/Mechanize/Script/Plugin/RegexMatchTest.pm »