1 package App::Prove::State::Result::Test;
9 App::Prove::State::Result::Test - Individual test results.
21 The C<prove> command supports a C<--state> option that instructs it to
22 store persistent state across runs. This module encapsulates the results for a
28 $ prove --state=fail,save -rbv
33 name => { method => 'name' },
34 elapsed => { method => 'elapsed', default => 0 },
35 gen => { method => 'generation', default => 1 },
36 last_pass_time => { method => 'last_pass_time', default => undef },
37 last_fail_time => { method => 'last_fail_time', default => undef },
38 last_result => { method => 'result', default => 0 },
39 last_run_time => { method => 'run_time', default => undef },
40 last_todo => { method => 'num_todo', default => 0 },
41 mtime => { method => 'mtime', default => undef },
42 seq => { method => 'sequence', default => 1 },
43 total_passes => { method => 'total_passes', default => 0 },
44 total_failures => { method => 'total_failures', default => 0 },
45 parser => { method => 'parser' },
48 while ( my ( $key, $description ) = each %methods ) {
49 my $default = $description->{default};
51 *{ $description->{method} } = sub {
54 $self->{$key} = shift;
57 return $self->{$key} || $default;
70 my ( $class, $arg_for ) = @_;
72 bless $arg_for => $class;
75 =head2 Instance Methods
79 The name of the test. Usually a filename.
83 The total elapsed times the test took to run, in seconds from the epoch..
87 The number for the "generation" of the test run. The first generation is 1
88 (one) and subsequent generations are 2, 3, etc.
90 =head3 C<last_pass_time>
92 The last time the test program passed, in seconds from the epoch.
94 Returns C<undef> if the program has never passed.
96 =head3 C<last_fail_time>
98 The last time the test suite failed, in seconds from the epoch.
100 Returns C<undef> if the program has never failed.
104 Returns the mtime of the test, in seconds from the epoch.
108 Returns a hashref of raw test data, suitable for serialization by YAML.
112 Currently, whether or not the test suite passed with no 'problems' (such as
117 The total time it took for the test to run, in seconds. If C<Time::HiRes> is
118 available, it will have finer granularity.
122 The number of tests with TODO directives.
126 The order in which this test was run for the given test suite result.
128 =head3 C<total_passes>
130 The number of times the test has passed.
132 =head3 C<total_failures>
134 The number of times the test has failed.
138 The underlying parser object. This is useful if you need the full
139 information for the test program.
147 # this is backwards-compatibility hack and is not guaranteed.