Logo Search packages:      
Sourcecode: qm version File versions

qm::test::result::Result Class Reference

List of all members.

Detailed Description

A 'Result' describes the outcome of a test.

A 'Result' contains two pieces of data: an outcome and a set
of annotations.  The outcome indicates whether the test passed
or failed.  More specifically, the outcome may be one of the
following constants:

'Result.PASS' -- The test passed.

'Result.FAIL' -- The test failed.

'Result.ERROR' -- Something went wrong in the process of trying to
execute the test.  For example, if the Python code implementing
the 'Run' method in the test class raised an exception, the
outcome would be 'Result.ERROR'.

'Result.UNTESTED' -- QMTest did not even try to run the test.
For example, if a prerequiste was not satisfied, then this outcome
will be used.'

The annotations are a dictionary, mapping strings to strings.

The indices should be of the form 'class.name' where 'class' is
the name of the test class that created the annotation.  Any
annotations created by QMTest, as opposed to the test class, will
have indices of the form 'qmtest.name'.

The annotation values are HTML.  When displayed in the GUI, the
HTML is inserted directly into the result page; when the
command-line interface is used the HTML is converted to plain

Currently, QMTest recognizes the following built-in annotations:

'Result.CAUSE' -- For results whose outcome is not 'FAIL', this
annotation gives a brief description of why the test failed.  The
preferred form of this message is a phrase like "Incorrect
output." or "Exception thrown."  The message should begin with a
capital letter and end with a period.  Most results formatters
will display this information prominently.

'Result.EXCEPTION' -- If an exeption was thrown during the
test execution, a brief description of the exception.

'Result.TARGET' -- This annotation indicates on which target the
test was executed.

'Result.TRACEBACK' -- If an exeption was thrown during the test
execution, a representation of the traceback indicating where
the exception was thrown.

A 'Result' object has methods that allow it to act as a dictionary
from annotation names to annotation values.  You can directly add
an annotation to a 'Result' by writing code of the form
'result[CAUSE] = "Exception thrown."'.

A 'Result' object is also used to describe the outcome of
executing either setup or cleanup phase of a 'Resource'.

Definition at line 30 of file result.py.

Public Member Functions

def __delitem__
def __getitem__
def __getstate__
def __init__
def __setitem__
def __setstate__
def Annotate
def Fail
def get
def GetCause
def GetId
def GetKind
def GetOutcome
def has_key
def items
def keys
def MakeDomNode
def NoteException
def Quote
def SetOutcome

Static Public Attributes

string CAUSE = "qmtest.cause"
string END_TIME = "qmtest.end_time"
string ERROR = "ERROR"
string EXCEPTION = "qmtest.exception"
string FAIL = "FAIL"
list outcomes = [ ERROR, FAIL, UNTESTED, PASS ]
string PASS = "PASS"
string RESOURCE = "qmtest.resource"
string RESOURCE_CLEANUP = "resource_cleanup"
string RESOURCE_SETUP = "resource_setup"
string START_TIME = "qmtest.start_time"
string TARGET = "qmtest.target"
string TEST = "test"
string TRACEBACK = "qmtest.traceback"

Private Attributes


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

Generated by  Doxygen 1.6.0   Back to index