qm :: test :: database :: ItemDescriptor :: Class ItemDescriptor
[hide private]
[frames] | no frames]

Class ItemDescriptor

source code

Known Subclasses:

An 'ItemDescriptor' describes a test, resource, or similar entity.

Some 'Database' operations return an instance of a class derived from 'ItemDescriptor', rather than the object described. For example, 'Database.GetTest' returns a 'TestDescriptor', not a 'Test'. This additional indirection is an optimization; the creation of the actual 'Test' object may be relatively expensive, and in many cases all that is needed is information that can be gleaned from the descriptor.

Instance Methods [hide private]
 
__init__(self, database, instance_id, class_name=None, arguments=None, item=None)
Construct an 'ItemDescriptor'.
source code
 
GetDatabase(self)
Return the 'Database' containing this entity.
source code
 
GetClassName(self)
Return the class name of the entity.
source code
 
GetClass(self)
Return the class of the entity.
source code
 
GetClassArguments(self)
Return the arguments specified by the test class.
source code
 
GetArguments(self)
Return the entity arguments.
source code
 
GetId(self)
Return the label for this entity.
source code
 
GetItem(self)
Return the entity.
source code
 
GetResources(self)
Return the resources required by this item.
source code
 
_Execute(self, context, result, method)
Execute the entity.
source code
Method Details [hide private]

__init__(self, database, instance_id, class_name=None, arguments=None, item=None)
(Constructor)

source code 

Construct an 'ItemDescriptor'.

'database' -- The 'Database' object in which this entity is located.

'instance_id' -- The label for this entity.

'class_name' -- The name of the extension class for the entity. For example, for a 'TestDescriptor', the 'class_name' is the name of the test class. Omit this argument if 'item' is provided.

'arguments' -- A dictionary mapping argument names to argument values. These arguments will be provided to the extension class when the entity is constructed. Omit this argument if 'item' is provided.

'item' -- The item class for this item instance.

GetDatabase(self)

source code 

Return the 'Database' containing this entity.

returns -- The 'Database' object in which this entity is located.

GetClassName(self)

source code 

Return the class name of the entity.

returns -- The name of the extension class for the entity. For example, for a 'TestDescriptor', this method returns the name of the test class.

GetClass(self)

source code 

Return the class of the entity.

returns -- The Python class object for the entity. For example, for a 'TestDescriptor', this method returns the test class.

GetClassArguments(self)

source code 

Return the arguments specified by the test class.

returns -- A list of 'Field' objects containing all the arguments in the class hierarchy.

Derived classes should not override this method.

GetArguments(self)

source code 

Return the entity arguments.

returns -- A dictionary mapping argument names to argument values. These arguments will be provided to the extension class when the entity is constructed.

GetId(self)

source code 

Return the label for this entity.

returns -- The label for this entity.

GetItem(self)

source code 

Return the entity.

returns -- An instance of the class returned by 'GetClass'.

GetResources(self)

source code 

Return the resources required by this item.

returns -- A sequence of resource names. Each name indicates a resource that must be available to this item.

_Execute(self, context, result, method)

source code 

Execute the entity.

'context' -- The 'Context' in which the test should be executed, or 'None' if the 'method' does not take a 'Context' argument.

'result' -- The 'Result' object corresponding to this execution.

'method' -- The method name of the method on the entity that should be invoked to perform the execution.