GSP
Quick Navigator

Search Site

Unix VPS
A - Starter
B - Basic
C - Preferred
D - Commercial
MPS - Dedicated
Previous VPSs
* Sign Up! *

Support
Contact Us
Online Help
Handbooks
Domain Status
Man Pages

FAQ
Virtual Servers
Pricing
Billing
Technical

Network
Facilities
Connectivity
Topology Map

Miscellaneous
Server Agreement
Year 2038
Credits
 

USA Flag

 

 

Man Pages


Manual Reference Pages  -  TEST::LECTROTEST::FAILURERECORDER (3)

.ds Aq ’

NAME

Test::LectroTest::FailureRecorder - Records/plays failures for regression testing

CONTENTS

VERSION

version 0.5001

SYNOPSIS



 use Test::LectroTest::Recorder;

 my $recorder = Test::LectroTest::Recorder->new("storage_file.txt");

 my $recorder->record_failure_for_property(
    "property name",
    $input_hashref_from_counterexample
 );

 my $failures = $recorder->get_failures_for_property("property name");
 for my $input_hashref (@$failures) {
    # do something with hashref
 }



DESCRIPTION

This module provides a simple means of recording property-check failures so they can be reused as regression tests. You do not need to use this module yourself because the higher-level LectroTest modules will use it for you when needed. (These docs are mainly for LectroTest developers.)

The basic idea is to record a failure as a pair of the form



 [ <property_name>, <input hash from counterexample> ]



and Dump these pairs into a text file, each record terminated by blank line so that the file can be read using paragraph-slurp mode.

The module provides methods to add such pairs to a recorder file and to retrieve the recorded failures by property name. It uses a cache to avoid repetitive reads.

METHODS

new(storage-file)



  my $recorder = Test::LectroTest::Recorder->new("/path/to/storage.txt");



Creates a new recorder object and tells it to use storage-file for the reading and writing of failures.

The recorder will not access the storage file until you attempt to get or record a failure. Thus it is OK to specify a storage file that does not yet exist, provided you record failures to it before you attempt to get failures from it.

get_failures_for_property(propname)



  my $failures = $recorder->get_failures_for_property("property name");
  for my $input_hashref (@$failures) {
     # do something with hashref
     while (my ($var, $value) = each %$input_hashref) {
         # ...
     }
  }



Returns a reference to an array that contains the recorded failures for the property with the name propname. In the event no such failures exist, the array will be empty. Each failure is represented by a hash containing the inputs that caused the failure.

If the recorder’s storage file does not exist or cannot be opened for reading, this method dies. Thus, you should call it from within an eval block.

record_failure_for_property(propname, input-hashref)



  my $recorder->record_failure_for_property(
     "property name",
     $input_hashref_from_counterexample
  );



Adds a failure record for the property named propname. The record captures the counterexample represented by the input-hashref. The record is immediately appended to the recorder’s storage file.

Returns 1 upon success; dies otherwise.

If the recorder’s storage file cannot be opened for writing, this method dies. Thus, you should call it from within an eval block.

SEE ALSO

Test::LectroTest::TestRunner explains the internal testing apparatus, which uses the failure recorders to record and play back failures for regression testing.

AUTHOR

Tom Moertel (tom@moertel.com)

COPYRIGHT and LICENSE

Copyright (c) 2004-13 by Thomas G Moertel. All rights reserved.

This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.

Search for    or go to Top of page |  Section 3 |  Main Index


perl v5.20.3 TEST::LECTROTEST::FAILURERECORDER (3) 2013-05-16

Powered by GSP Visit the GSP FreeBSD Man Page Interface.
Output converted with manServer 1.07.