Branch Coverage

blib/lib/TestRail/API.pm
Criterion Covered Total %
branch 216 286 75.5


line true false branch
46 1 105 unless is_uri($apiurl)
73 56 49 if ($self->{'do_post_redirect'})
83 0 105 unless $self->{'encoding-nonaliased'}
89 0 105 unless grep {$_ eq $self->{'encoding-nonaliased'};} "Encode"->encodings(":all")
97 104 1 if $self->debug
102 1 0 unless ($userfetch_opts->{'skip_usercache'})
104 0 1 unless defined $res
105 1 0 if ((&reftype($res) || 'undef') ne "ARRAY")
106 0 1 unless &looks_like_number($res)
108 1 0 if $res == -500
111 0 0 if $res == -403
114 0 0 if $res == -401
115 0 0 if $res < 0
121 0 0 unless scalar @$res
156 107 1615 if $self->debug
163 632 1090 $data ? :
181 0 1722 if ($@)
184 0 0 if ($self->{'num_tries'} >= $self->{'max_tries'})
190 0 0 if $self->{'retry_delay'}
194 0 1722 unless defined $response
196 1 1721 if ($response->code == 403)
199 1 1720 if ($response->code == 401)
203 117 1603 if ($response->code != 200)
206 115 2 if ($self->{'num_tries'} >= $self->{'max_tries'})
216 1 1 if $self->{'retry_delay'}
226 9 0 if ($response->code == 200 and not $response->content) { }
232 0 0 unless ($self->debug)
249 6 72 if ref $self->{'user_cache'} eq "ARRAY" and scalar @{$self->{'user_cache'};}
250 56 16 $project_id ? :
252 10 60 if not $res or (&reftype($res) || 'undef') ne "ARRAY"
262 2 1 if ref $users ne "ARRAY"
264 1 0 if $usr->{'id'} == $user
274 2 1 if ref $users ne "ARRAY"
276 1 0 if $usr->{'name'} eq $user
286 2 1 if ref $users ne "ARRAY"
288 1 0 if $usr->{'email'} eq $email
297 1 6 unless scalar @$names
301 8 4 scalar @list ? :
303 1 5 unless scalar @$names == scalar @ret
343 6 100 if not $result or (&reftype($result) || 'undef') ne "ARRAY"
347 0 100 if not $result or (&reftype($result) || 'undef') ne "ARRAY"
361 0 120 if not $projects or (&reftype($projects) || 'undef') ne "ARRAY"
362 83 37 unless scalar @$projects
365 2 118 if not $projects or (&reftype($projects) || 'undef') ne "ARRAY"
367 117 115 if $candidate->{'name'} eq $project
379 6 1 unless scalar @$projects
382 2 5 if not $projects or (&reftype($projects) || 'undef') ne "ARRAY"
384 5 2 if $candidate->{'id'} eq $project
425 2 9 if not $suites or (&reftype($suites) || 'undef') ne "ARRAY"
430 9 0 if $suite->{'name'} eq $testsuite_name
450 0 3 if $parent_id
469 16 14 if $self->{'sections'}{$suite_id}
488 2 2 if not $sections or (&reftype($sections) || 'undef') ne "ARRAY"
490 2 4 if $sec->{'name'} eq $section_name
500 1 10 if not $sections_orig or (&reftype($sections_orig) || 'undef') ne "ARRAY"
503 25 25 $_->{'parent_id'} ? :
507 45 27 $_->{'parent_id'} ? :
515 0 12 unless my $sections = $self->getSections($project_id, $suite_id)
523 9 7 if defined $self->{'type_cache'}
526 4 3 if not $types or (&reftype($types) || 'undef') ne "ARRAY"
537 2 10 if not $types or (&reftype($types) || 'undef') ne "ARRAY"
539 10 6 if $type->{'name'} eq $name
563 0 3 if (defined $extras and &reftype($extras) eq "HASH")
565 0 0 if defined $extras->{'priority_id'}
567 0 0 if defined $extras->{'estimate'}
569 0 0 if defined $extras->{'milestone_id'}
571 0 0 if defined $extras->{'refs'}
575 0 3 if (defined $opts and &reftype($opts) eq "HASH")
617 3 1 if not $cases or (&reftype($cases) || 'undef') ne "ARRAY"
619 1 0 if $case->{'title'} eq $name
634 1 2 if $self->{'case_fields'}
653 2 2 if defined $self->{'priority_cache'}
656 1 1 if not $priorities or (&reftype($priorities) || 'undef') ne "ARRAY"
668 0 1 if not $priorities or (&reftype($priorities) || 'undef') ne "ARRAY"
671 1 0 if $priority->{'name'} eq $name
693 4 270 defined $case_ids ? :
721 4 107 unless (&reftype($initial_runs) || 'undef') eq "ARRAY"
748 0 134 if $limit > $self->{'global_limit'}
750 133 1 if defined $offset
751 133 1 if $limit
762 2 56 if not $runs or (&reftype($runs) || 'undef') ne "ARRAY"
764 37 141 if $run->{'name'} eq $name
786 1 13 unless scalar @$runs
798 65 52 $_->{'id'} < 6 ? :
811 837 2511 unless exists $shash{$status}
814 22599 0 if exists $shash{$status}
840 0 1 unless (&reftype($initial_results) || 'undef') eq "ARRAY"
867 0 1 if $limit > $self->{'global_limit'}
869 0 1 if defined $offset
870 1 0 if $limit
882 2 2429 unless defined $plan->{'entries'} and (&reftype($plan->{'entries'}) || 'undef') eq "ARRAY"
888 2458 0 if defined $entry->{'runs'} and (&reftype($entry->{'runs'}) || 'undef') eq "ARRAY"
901 2 38 if $testsuite_id
902 1 39 unless $runs
907 38 1 if (defined $configurations)
915 0 39 if defined $configurations and scalar @pconfigs != scalar @$configurations
921 3 35 if $run->{'name'} ne $name
922 1 34 if scalar @pconfigs != scalar @{$run->{'config_ids'};}
927 31 2 if grep {$_ == $cid;} @pconfigs
930 32 2 if $found == scalar @{$run->{'config_ids'};}
970 4 100 unless (&reftype($initial_plans) || 'undef') eq "ARRAY"
997 0 124 if $limit > $self->{'global_limit'}
999 123 1 if defined $offset
1000 123 1 if $limit
1011 2 47 if not $plans or (&reftype($plans) || 'undef') ne "ARRAY"
1013 39 817 if ($plan->{'name'} eq $name)
1041 45 54 unless defined $ret->{'totals'}{$key}
1049 0 45 if grep {$_ eq $key;} "plan", "configs", "percentages"
1068 1 10 defined $case_ids ? :
1076 1 10 defined $case_ids ? :
1134 2 1 if not $milestones or (&reftype($milestones) || 'undef') ne "ARRAY"
1137 1 0 if $milestone->{'name'} eq $name
1157 7 0 if defined $status_ids and scalar @$status_ids
1162 6 0 if defined $assignedto_ids and scalar @$assignedto_ids
1163 8 14 if defined $aid
1180 47 2 unless $tests
1181 2 47 if not $tests or (&reftype($tests) || 'undef') ne "ARRAY"
1183 46 91 if $test->{'title'} eq $name
1199 3 17 if defined $self->{'tr_fields'}
1211 2 15 unless scalar @candidates
1212 0 15 if ref $candidates[0] ne "HASH"
1215 0 15 if ref $candidates[0]{'configs'} ne "ARRAY" and not scalar @{$candidates[0]{'configs'};}
1219 1 14 unless defined $project_id
1225 13 21 if grep {$_ == $project_id;} @{$$config{"context"}{"project_ids"};}
1234 30 81 if $self->{'status_cache'}
1262 123 404 if ($member->{'name'} eq $name)
1268 4 93 unless scalar @$names == scalar @ret
1288 44 10 if (defined $opts and &reftype($opts) eq "HASH")
1290 8 36 defined $opts->{'version'} ? :
1292 14 30 defined $opts->{'elapsed'} ? :
1295 0 44 defined $opts->{'defects'} ? :
1299 0 44 defined $opts->{'assignedto_id'} ? :
1304 7 47 if (defined $custom_fields and &reftype($custom_fields) eq "HASH")
1340 8 3 if $limit
1341 0 11 if defined $offset
1354 0 0 if $limit
1355 0 0 if defined $offset
1373 0 4 if ref $cgroups ne "ARRAY"
1375 3 1 unless scalar @$cgroups
1409 3 190 unless (&reftype($cgroups) || 'undef') eq "ARRAY"
1442 0 60 unless my $configs = $self->getConfigurations($project_id)
1483 0 29 if (ref $filters->{$filter} eq 'ARRAY') { }
1489 21 8 if defined $filters->{$filter}