TestDB |
![]() |
TestDB - test case database class
Shane P. McCarron <shane@aptest.com>
Copyright 2002-2006 Applied Testing and Technology, Inc. All Rights Reserved.
use TestDB;
Open the cache Database for writing
my $db = new TestDB(1);
get a handle to the whole test database
$data = $db->test();
get a handle to a specific test's data
$data = $db->test($testID);
release the database
$db-E<gt>release();
The TestDB object is a generic multi-level data structure storage facility. The data stored in this facility is expected to be keyed by a unique value - probably the ID of the test case.
The data structure of this object is optimized to be most efficient when used in conjunction with MLDBM and a single key hashed database. This object CAN use serialized objects as well, but it is MUCH slower. Note that when using MLDBM, the save method doesn't do anything (except possibly for the first time it is called if the database had not yet been converted to MLDBM format).
$tdb = new TestDB(suite, [read/write [, timeout[, path]]]);
Creates a new test database object, optionally opening a non-default target file and optionally making it writeable.
returns a reference to the test database object.
Removes all tests from the database. Must have a write lock before you can do this.
returns true if it succeeded, false if it did not.
$tdb->numTests();
returns the number of tests in the database.
returns a path to the cache file.
$tdb->print();
$tdb->print(ID);
returns the string-ified version of the entire database, or just the contents of the test ID.
$res = $tdb->deleted(name) ;
Returns true if the file is in $deletedDir, and false if it is not.
$res = $tdb->recycled(name) ;
Returns true if the file is in the recycle bin, and false if it is not.
returns the path saved into, or undef if the save failed.
returns a list of all tests
returns a list of defined tests
$tdb->test();
$tdb->test(ID);
$tdb->test(ID, ref);
With no parameter, retrieves a pointer to the raw test database hash.
With an ID parameter, retrieves the data for a specific ID.
With an ID and a ref, sets the parameters for a test to ref.
returns the pointer to the entire hash, or to the data for a specific test.
Returns the current ID for a test case that matches the UUID. Returns undef if there is no such test case.
$tdb->delete($test);
deletes a test if it is defined. Also updates the collection of UUIDs so the test is no longer indexed.
$suiteDb = $tdb->suiteDB();
$suiteDb = $tdb->suiteDB(handle);
handle is the handle to an existing suiteDB object.
Returns the handle to a SuiteDB object. If one is not already associated with the session, acquires one in write mode.
Updates the associated SuiteDB, if there is one, to ensure the last edit time is correct.
Returns undef if there is no SuiteDB associated with this session, 0 if the update failed, and 1 if it succeeded.
Copyright © 2000-2006 Applied Testing and Technology, Inc. All rights reserved.