blib/lib/Tapper/Reports/Web/Util/Testrun.pm

filter: Statementstmt 29.4% 10 / 34 Branchbran 0.0% 0 / 14 Conditioncond 0.0% 0 / 12 MC/DCmcdc 0.0% 0 / 7 Subroutinesub 66.6% 2 / 3 Podpod 100% 1 / 1 totaltotal 18.3% 13 / 71 CC 14 SCAR 52.1
CC
14
Cov
17%
prepare_testrunlist
210.0
BEGIN
1.0
BEGIN
1.0
CRAP 183.9
« blib/lib/Tapper/Reports/Web/Util/Report.pm ↑ Summary blib/lib/Tapper/Reports/Web/Controller/Tapper/Testplan.pm »
1 package Tapper::Reports::Web::Util::Testrun;
2 15 our $AUTHORITY = 'cpan:TAPPER';
3 15 $Tapper::Reports::Web::Util::Testrun::VERSION = '5.0.17';
4 15 ▶use Moose;
Subroutine BEGIN: called CC=1 SCAR=0.0
5 15 ▶use Tapper::Model 'model';
Subroutine BEGIN: called CC=1 SCAR=0.0
6  
7 15 extends 'Tapper::Reports::Web::Util';
8  
9  
10  
11 sub prepare_testrunlist
12 0 ▶{
Subroutine prepare_testrunlist: not called CC=14 SCAR=53.5
Pod documented
13 0 my ( $self, $testruns ) = @_;
14  
15 0 my @testruns;
16 0 foreach my $testrun ($testruns->all)
17 {
18 0 my $testrun_report = model('ReportsDB')->resultset('ReportgroupTestrunStats')->search({testrun_id => $testrun->id}, {rows => 1})->first;
19 0 my ($primary_report, $suite_name, $updated_at, $primary_report_id);
20  
21 0 ▶ if ($testrun_report) {
Branch: 1 branch
BranchTrueFalseTotal
if ($testrun_report) 0 0 0
22 0 $primary_report = $testrun_report->reportgrouptestruns->search({primaryreport => 1}, {rows => 1})->first;
23 0 ▶ $primary_report = $testrun_report->reportgrouptestruns->search({}, {rows => 1})->first unless $primary_report; # link to any report if no primary
Branch: 1 branch
BranchTrueFalseTotal
unless $primary_report 0 0 0
24  
25 0 eval{ # prevent dereferencing to undefined db links
26 0 ▶ if ($primary_report) {
Branch: 1 branch
BranchTrueFalseTotal
if ($primary_report) 0 0 0
27 0 $suite_name = $primary_report->report->suite->name;
28 0 ▶ $updated_at = $primary_report->report->updated_at || $primary_report->created_at;
Condition0%0/3
$primary_report->report->updated_at || $primary_report->created_at
l!l&&r!l&&!r
000
MC/DC0%0/2
$primary_report->report->updated_at || $primary_report->created_at
$primary_report->report->updated_at $primary_report->created_at
Truth table0%0/3
A || B
A= $primary_report->report->updated_atB= $primary_report->created_at
ABresult
1X1
011
000
29 0 $primary_report_id = $primary_report->report->id;
30 }
31 };
32 }
33  
34  
35 0 my ($hostname, $status);
36 0 ▶ if ($testrun->testrun_scheduling) {
Branch: 1 branch
BranchTrueFalseTotal
if ($testrun->testrun_scheduling) 0 0 0
37 0 ▶ if ($testrun->testrun_scheduling->host) {
Branch: 1 branch
BranchTrueFalseTotal
if ($testrun->testrun_scheduling->host) { } 0 0 0
38 0 $hostname = $testrun->testrun_scheduling->host->name;
39 } else {
40 0 ▶ $hostname = $testrun->testrun_scheduling->status eq 'finished' ?
Branch: 1 branch
BranchTrueFalseTotal
$testrun->testrun_scheduling->status eq 'finished' ? : 0 0 0
41 'Host deleted' :
42 'No host assigned';
43  
44 }
45 0 $status = $testrun->testrun_scheduling->status;
46 }
47  
48 0 my @resources = $testrun->claimed_resources;
49  
50 0 my @dependencies = $testrun->depending_testruns;
51  
52 0 ▶ my $tr = {
Branch: 1 branch
BranchTrueFalseTotal
$testrun_report ? : 0 0 0
Condition0%0/9
$hostname || 'unknownmachine'
l!l
00
$status || 'unknown status'
l!l
00
$updated_at || $testrun->updated_at
l!l&&r!l&&!r
000
$testrun->owner->login || 'unknown user'
l!l
00
MC/DC0%0/1
$hostname || 'unknownmachine'
$hostname
MC/DC0%0/1
$status || 'unknown status'
$status
MC/DC0%0/2
$updated_at || $testrun->updated_at
$updated_at $testrun->updated_at
MC/DC0%0/1
$testrun->owner->login || 'unknown user'
$testrun->owner->login
Truth table0%0/2
A
A= $hostname
Aresult
11
00
Truth table0%0/2
A
A= $status
Aresult
11
00
Truth table0%0/3
A || B
A= $updated_atB= $testrun->updated_at
ABresult
1X1
011
000
Truth table0%0/2
A
A= $testrun->owner->login
Aresult
11
00
53 testrun_id => $testrun->id,
54 success_ratio => $testrun_report ? $testrun_report->success_ratio : 0,
55 primary_report_id => $primary_report_id,
56 topic_name => $testrun->topic_name,
57 machine_name => $hostname || 'unknownmachine',
58 status => $status || 'unknown status',
59 started_at => $testrun->starttime_testrun,
60 created_at => $testrun->created_at,
61 updated_at => $updated_at || $testrun->updated_at,
62 owner => $testrun->owner->login || 'unknown user' ,
63 resources => \@resources,
64 dependencies => \@dependencies,
65 };
66 0 push @testruns, $tr;
67 }
68 0 return \@testruns;
69 }
70  
71  
72 15 1;
73  
74 __END__
« blib/lib/Tapper/Reports/Web/Util/Report.pm ↑ Summary blib/lib/Tapper/Reports/Web/Controller/Tapper/Testplan.pm »