A Test is run to check for correct behavior.
A Test performs some check on the system being tested, and
indicates whether the check was successful, or whether the
check failed.
Each test class (i.e., class derived from Test ) describes a set
of "arguments". Each argument has a name and a type. The values
of these arguments determine the design-time parameters for the
test. For example, for a test class that executes program and
checks their exit codes, the arguments might consist of the
name of the program to execute, and the command-line arguments
that should be given to that program. QMTest uses the arguments
to prompt the user when creating a new test.
Each test class also defines a Run method that indicates how
to run tests in that class. The Run method is responsible for
actually performing the test and for reporting the results.
Test is an abstract class.
You can extend QMTest by providing your own test class
implementation. If the test classes that come with QMTest cannot
be used conveniently with your application domain, or if you would
like to report more detailed information about passing and failing
tests, you may wish to create a new test class.
To create your own test class, you must create a Python class
derived (directly or indirectly) from Test . The documentation
for each method of Test indicates whether you must override it
in your test class 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 test and that method raises an
exception that is not caught within the method itself, QMTest will
catch the exception and continue processing.
Methods
|
|
GetTargetGroup
Run
|
|
GetTargetGroup
|
GetTargetGroup ( self )
Returns the pattern for the targets that can run this test.
- returns
- A regular expression (represented as a string) that
indicates the targets on which this test can be run. If the
pattern matches a particular group name, the test can be run
on targets in that group.
|
|
Run
|
Run (
self,
context,
result,
)
Run the test.
-
context
- A
Context giving run-time parameters to the
test.
-
result
- A
Result object. The outcome will be
Result.PASS when this method is called. The result may be
modified by this method to indicate outcomes other than
Result.PASS or to add annotations.
This method should not return a value.
Derived classes must override this method.
|
|