| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
|
|
|
|
|
|
package Test::Run::Plugin::CollectStats; |
|
2
|
|
|
|
|
|
|
|
|
3
|
2
|
|
|
2
|
|
155978
|
use warnings; |
|
|
2
|
|
|
|
|
14
|
|
|
|
2
|
|
|
|
|
62
|
|
|
4
|
2
|
|
|
2
|
|
9
|
use strict; |
|
|
2
|
|
|
|
|
3
|
|
|
|
2
|
|
|
|
|
34
|
|
|
5
|
|
|
|
|
|
|
|
|
6
|
2
|
|
|
2
|
|
983
|
use Moose; |
|
|
2
|
|
|
|
|
796022
|
|
|
|
2
|
|
|
|
|
13
|
|
|
7
|
|
|
|
|
|
|
|
|
8
|
2
|
|
|
2
|
|
12840
|
use MRO::Compat; |
|
|
2
|
|
|
|
|
4
|
|
|
|
2
|
|
|
|
|
40
|
|
|
9
|
2
|
|
|
2
|
|
1533
|
use Storable (); |
|
|
2
|
|
|
|
|
5797
|
|
|
|
2
|
|
|
|
|
69
|
|
|
10
|
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
extends('Test::Run::Base'); |
|
12
|
|
|
|
|
|
|
|
|
13
|
2
|
|
|
2
|
|
883
|
use Test::Run::Plugin::CollectStats::TestFileData; |
|
|
2
|
|
|
|
|
7
|
|
|
|
2
|
|
|
|
|
663
|
|
|
14
|
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
=head1 NAME |
|
16
|
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
Test::Run::Plugin::CollectStats - Test::Run plugin to collect statistics and |
|
18
|
|
|
|
|
|
|
data. |
|
19
|
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
=head1 VERSION |
|
21
|
|
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
Version 0.0104 |
|
23
|
|
|
|
|
|
|
|
|
24
|
|
|
|
|
|
|
=cut |
|
25
|
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
has '_recorded_test_files_data' => (is => "rw", isa => "ArrayRef", |
|
27
|
|
|
|
|
|
|
default => sub { [] }, |
|
28
|
|
|
|
|
|
|
); |
|
29
|
|
|
|
|
|
|
|
|
30
|
|
|
|
|
|
|
has '_test_files_names_map' => (is => "rw", isa => "HashRef", |
|
31
|
|
|
|
|
|
|
default => sub { +{} }, |
|
32
|
|
|
|
|
|
|
); |
|
33
|
|
|
|
|
|
|
|
|
34
|
|
|
|
|
|
|
our $VERSION = '0.0104'; |
|
35
|
|
|
|
|
|
|
|
|
36
|
|
|
|
|
|
|
=head1 SYNOPSIS |
|
37
|
|
|
|
|
|
|
|
|
38
|
|
|
|
|
|
|
package MyTestRun; |
|
39
|
|
|
|
|
|
|
|
|
40
|
|
|
|
|
|
|
use base 'Test::Run::Plugin::AlternateInterpreters'; |
|
41
|
|
|
|
|
|
|
use base 'Test::Run::Obj'; |
|
42
|
|
|
|
|
|
|
|
|
43
|
|
|
|
|
|
|
=head1 METHODS |
|
44
|
|
|
|
|
|
|
|
|
45
|
|
|
|
|
|
|
=cut |
|
46
|
|
|
|
|
|
|
|
|
47
|
|
|
|
|
|
|
sub _run_single_test |
|
48
|
|
|
|
|
|
|
{ |
|
49
|
2
|
|
|
2
|
|
70453
|
my ($self, $args) = @_; |
|
50
|
|
|
|
|
|
|
|
|
51
|
2
|
|
|
|
|
7
|
my $filename = $args->{test_file}; |
|
52
|
|
|
|
|
|
|
|
|
53
|
2
|
|
|
|
|
24
|
$self->next::method($args); |
|
54
|
|
|
|
|
|
|
|
|
55
|
|
|
|
|
|
|
$self->_test_files_names_map->{$filename} = |
|
56
|
2
|
|
|
|
|
233752
|
scalar(@{$self->_recorded_test_files_data()}); |
|
|
2
|
|
|
|
|
103
|
|
|
57
|
|
|
|
|
|
|
|
|
58
|
2
|
|
|
|
|
5
|
push @{$self->_recorded_test_files_data}, |
|
|
2
|
|
|
|
|
67
|
|
|
59
|
|
|
|
|
|
|
Test::Run::Plugin::CollectStats::TestFileData->new( |
|
60
|
|
|
|
|
|
|
{ |
|
61
|
|
|
|
|
|
|
elapsed_time => $self->last_test_elapsed(), |
|
62
|
|
|
|
|
|
|
results => Storable::dclone($self->last_test_results()), |
|
63
|
|
|
|
|
|
|
summary_object => Storable::dclone($self->last_test_obj()), |
|
64
|
|
|
|
|
|
|
} |
|
65
|
|
|
|
|
|
|
); |
|
66
|
|
|
|
|
|
|
|
|
67
|
2
|
|
|
|
|
4491
|
return; |
|
68
|
|
|
|
|
|
|
} |
|
69
|
|
|
|
|
|
|
|
|
70
|
|
|
|
|
|
|
=head2 $tester->get_recorded_test_file_data($index) |
|
71
|
|
|
|
|
|
|
|
|
72
|
|
|
|
|
|
|
Returns the L<Test::Run::Plugin::CollectStats::TestFileData> instance |
|
73
|
|
|
|
|
|
|
representing the results of test number $index. |
|
74
|
|
|
|
|
|
|
|
|
75
|
|
|
|
|
|
|
=cut |
|
76
|
|
|
|
|
|
|
|
|
77
|
|
|
|
|
|
|
sub get_recorded_test_file_data |
|
78
|
|
|
|
|
|
|
{ |
|
79
|
3
|
|
|
3
|
1
|
8
|
my $self = shift; |
|
80
|
3
|
|
|
|
|
5
|
my $idx = shift; |
|
81
|
|
|
|
|
|
|
|
|
82
|
3
|
|
|
|
|
116
|
return $self->_recorded_test_files_data->[$idx]; |
|
83
|
|
|
|
|
|
|
} |
|
84
|
|
|
|
|
|
|
|
|
85
|
|
|
|
|
|
|
=head2 $tester->find_test_file_idx_by_filename($filename) |
|
86
|
|
|
|
|
|
|
|
|
87
|
|
|
|
|
|
|
Retrieves the (last) index of the test file $filename. |
|
88
|
|
|
|
|
|
|
|
|
89
|
|
|
|
|
|
|
=cut |
|
90
|
|
|
|
|
|
|
|
|
91
|
|
|
|
|
|
|
sub find_test_file_idx_by_filename |
|
92
|
|
|
|
|
|
|
{ |
|
93
|
4
|
|
|
4
|
1
|
14
|
my $self = shift; |
|
94
|
4
|
|
|
|
|
23
|
my $filename = shift; |
|
95
|
|
|
|
|
|
|
|
|
96
|
4
|
|
|
|
|
157
|
return $self->_test_files_names_map->{$filename}; |
|
97
|
|
|
|
|
|
|
} |
|
98
|
|
|
|
|
|
|
|
|
99
|
|
|
|
|
|
|
=head2 $tester->get_num_collected_tests() |
|
100
|
|
|
|
|
|
|
|
|
101
|
|
|
|
|
|
|
Retrieves the number of collected tests. |
|
102
|
|
|
|
|
|
|
|
|
103
|
|
|
|
|
|
|
=cut |
|
104
|
|
|
|
|
|
|
|
|
105
|
|
|
|
|
|
|
sub get_num_collected_tests |
|
106
|
|
|
|
|
|
|
{ |
|
107
|
1
|
|
|
1
|
1
|
3084
|
my $self = shift; |
|
108
|
|
|
|
|
|
|
|
|
109
|
1
|
|
|
|
|
7
|
return scalar(@{$self->_recorded_test_files_data}); |
|
|
1
|
|
|
|
|
51
|
|
|
110
|
|
|
|
|
|
|
} |
|
111
|
|
|
|
|
|
|
|
|
112
|
|
|
|
|
|
|
=head2 $tester->get_filename_test_data($filename) |
|
113
|
|
|
|
|
|
|
|
|
114
|
|
|
|
|
|
|
Returns theL<Test::Run::Plugin::CollectStats::TestFileData> instance |
|
115
|
|
|
|
|
|
|
representing the results of the (last) test with the filename $filename. |
|
116
|
|
|
|
|
|
|
|
|
117
|
|
|
|
|
|
|
=cut |
|
118
|
|
|
|
|
|
|
|
|
119
|
|
|
|
|
|
|
sub get_filename_test_data |
|
120
|
|
|
|
|
|
|
{ |
|
121
|
2
|
|
|
2
|
1
|
927
|
my $self = shift; |
|
122
|
2
|
|
|
|
|
9
|
my $filename = shift; |
|
123
|
|
|
|
|
|
|
|
|
124
|
2
|
|
|
|
|
9
|
return $self->get_recorded_test_file_data( |
|
125
|
|
|
|
|
|
|
$self->find_test_file_idx_by_filename($filename) |
|
126
|
|
|
|
|
|
|
); |
|
127
|
|
|
|
|
|
|
} |
|
128
|
|
|
|
|
|
|
|
|
129
|
|
|
|
|
|
|
=head1 SEE ALSO |
|
130
|
|
|
|
|
|
|
|
|
131
|
|
|
|
|
|
|
L<Test::Run::Plugin::CollectStats::TestFileData>, L<Test::Run::Core>, |
|
132
|
|
|
|
|
|
|
L<Test::Run::Obj>. |
|
133
|
|
|
|
|
|
|
|
|
134
|
|
|
|
|
|
|
=head1 AUTHOR |
|
135
|
|
|
|
|
|
|
|
|
136
|
|
|
|
|
|
|
Shlomi Fish, C<< <shlomif at cpan.org> >> |
|
137
|
|
|
|
|
|
|
|
|
138
|
|
|
|
|
|
|
=head1 ACKNOWLEDGEMENTS |
|
139
|
|
|
|
|
|
|
|
|
140
|
|
|
|
|
|
|
=head1 COPYRIGHT & LICENSE |
|
141
|
|
|
|
|
|
|
|
|
142
|
|
|
|
|
|
|
Copyright 2007 Shlomi Fish. |
|
143
|
|
|
|
|
|
|
|
|
144
|
|
|
|
|
|
|
This program is released under the following license: MIT/Expat. |
|
145
|
|
|
|
|
|
|
|
|
146
|
|
|
|
|
|
|
=cut |
|
147
|
|
|
|
|
|
|
|
|
148
|
|
|
|
|
|
|
1; # End of Test::Run::Plugin::CollectStats |