Logo Search packages:      
Sourcecode: qm version File versions

qm::test::database::Database Class Reference

Inheritance diagram for qm::test::database::Database:

qm::extension::Extension qm::test::classes::mount_database::MountDatabase qm::test::file_database::FileDatabase regression_database::RegressionDatabase results_file_database::ResultsFileDatabase qm::test::file_database::ExtensionDatabase qm::test::classes::xml_database::XMLDatabase

List of all members.


Detailed Description

A 'Database' stores tests, testsuites, and resources.

A 'Database' has two primary functions:

1. Test storage and retrieval.

   Every test has a unique name, called a "test id". When a new 
   test is created, the 'Database' is responsible for writing that
   test to permanent storage.  Later, QMTest will request the test 
   by providing the database with the test id.  The database must
   retrieve the test from permanent storage.

   QMTest does not put any restrictions on *how* tests are stored.
   The default database implementation uses XML to store tests,
   but any storage format will do.

2. Test enumeration.

   The 'Database' can tell QMTest what tests are stored in the
   database.  QMTest uses this information in its graphical user
   interface to show the user what tests exist.
   
A 'Database' stores testsuites and resources in addition to tests.
The names for tests, testsuites, and resources are all "labels".  A
label is a special kind of string that is designed to be easily
convertible to a file name.  For more information, see the
'qm.label' module.  The namespaces for tests, testsuites, and
resources are all distinct.  For example, it is OK to have a test
with the same name as a testsuite.

Every 'Database' is associated with a particular directory on the
local machine.  In most cases, the 'Database' will store all the
files it needs within this directory.

Every 'Database' has an associated 'AttachmentStore'.  An
'AttachmentStore' is responsible for storing the attachments
associated with tests.  See the module 'qm.attachment' for more
information about 'AttachmentStore'.

'Database' is an abstract class.

You can extend QMTest by providing your own database implementation.
One reason to do this is that you may want to store tests in a
format different from the XML format that QMTest uses by default.
For example, if you are testing a compiler, you might want to
represent each test as a source file.  Or, if you are testing a
SQL database, you might want to represent each test as two files:
one containing SQL commands to run the test, and one containing
the output you expect.

Another reason to provide your own database implementation is that
you might want to store tests on a remote location.  For example,
suppose you wanted to allow multiple users to access the same 
central test database.  You could create a test database that
created and retrieved tests by communicating with the central
server.

To create your own database implementation, you must create a Python
class derived (directly or indirectly) from 'Database'.  The
documentation for each method of 'Database' indicates whether you
must override it in your database implementation.  Some methods may
be overridden, but do not need to be.  You might want to override
such a method to provide a more efficient implementation, but QMTest
will work fine if you just use the default version.

If QMTest calls a method on a database and that method raises an
exception that is not caught within the method itself, QMTest will
catch the exception and continue processing.  Therefore, methods
here only have to handle exceptions themselves if that is necessary
to maintain the integrity of the database.

A single 'Database' may be accessed by multiple threads
simultaneously.  Therefore, you must take appropriate steps to
ensure thread-safe access to shared data.

Definition at line 375 of file database.py.


Public Member Functions

def __getattr__
def __init__
def __init__
def ExpandIds
def GetAttachmentStore
def GetClassPaths
def GetConfigurationDirectory
def GetIds
def GetItem
def GetLabelComponents
def GetPath
def GetResource
def GetResourceClassNames
def GetResourceIds
def GetSubdirectories
def GetSuite
def GetSuiteIds
def GetTest
def GetTestClassNames
def GetTestIds
def HasResource
def HasSuite
def HasTest
def IsModifiable
def IsValidLabel
def JoinLabels
def MakeDomDocument
def MakeDomElement
def RemoveExtension
def SplitLabel
def SplitLabelLeft
def Write
def WriteExtension

Public Attributes

 modifiable

Static Public Attributes

list arguments
list ITEM_KINDS = [RESOURCE, SUITE, TEST]
string kind = "database"
string RESOURCE = "resource"
string SUITE = "suite"
string TEST = "test"

Private Attributes

 __path

Static Private Attributes

dictionary _item_exceptions

The documentation for this class was generated from the following file:

Generated by  Doxygen 1.6.0   Back to index