Once registered with the current run-context via rc.addTestRunListener
, an
implementation of the TestRunListener
interface will get notified whenever
test execution enters or exits a node and when a problem occurs. An illustrative example
is provided in the test-suite TestRunListener.qft
, located in the directory
demo/runlistener
in your QF-Test installation. Best deactivate the debugger
before running the whole test-suite.
Note A variant of the TestRunListener
interface called
DaemonTestRunLister
can be used to monitor a test-run remotely via the
daemon API. It is described in subsection 50.2.5.
The run listener API consists of the following classes:
The interface de.qfs.apps.qftest.extensions.qftest.TestRunListener
has
to be implemented and registered with a run-context via
rc.addTestRunListener()
.
Note
To implement the interface you can also derive from the class
de.qfs.apps.qftest.extensions.qftest.AbstractTestRunListener
which provides empty implementations of all methods so you only need to implement
those methods you are interested in.
|
|
|
void nodeEntered(TestRunEvent event) |
Parameters |
event | The event containing the details. |
|
void nodeExited(TestRunEvent event) |
Parameters |
event | The event containing the details. |
|
void problemOccurred(TestRunEvent event) |
Parameters |
event | The event containing the details. |
|
void runStarted(TestRunEvent event) |
Parameters |
event | The event containing the details, irrelevant in this case. |
|
void runStopped(TestRunEvent event) |
Parameters |
event | The event containing the details, irrelevant in this case. |
|
|
|
The class de.qfs.apps.qftest.extensions.qftest.TestRunEvent
holds
information about the currently executed nodes and the current error state. It defines
the following constants for execution states and error levels:
STATE_NOT_IMPLEMENTED
, STATE_SKIPPED
, STATE_OK
,
STATE_WARNING
, STATE_ERROR
and STATE_EXCEPTION
.
The first two states apply only to 'Test-set' and 'Test-case' nodes.
In the runStopped
method you can also check whether
the test run has been interrupted or completed normally. Therefore
the constants
STATE_RUN_INTERRUPTED
and
STATE_RUN_TERMINATED
are defined.
|
|
|
JsonObject asJsonValue() |
Returns |
The object as JsonObject .
|
|
int getErrors() |
Returns |
The total error count for the node just exited. Only available for
nodeExited .
|
|
int getExceptions() |
Returns |
The total exception count for the node just exited. Only available for
nodeExited .
|
|
int getLocalState() |
Returns |
The local execution state for the current node, the highest error level of this
node and its children regardless of whether this state propagates to the top.
Available only for nodeExited and problemOccurred . For
'Test-set' and 'Test-case' nodes the local state can also be one of
STATE_SKIPPED or STATE_NOT_IMPLEMENTED .
|
|
String getMessage() |
Returns |
The message for the current warning, error or exception. Only available for
problemOccurred .
|
|
TestSuiteNode getNode() |
Returns |
The current node or null for runStarted and runStopped .
|
|
TestSuiteNode[] getPath() |
Returns |
The path for the current node as seen from the run-log, equivalent to the
execution stack, or null for runStarted and runStopped .
The last node in the array is the current node.
|
|
int getState() |
Returns |
The overall propagating state for the current node, the highest error level of
this node and its children, possibly limited by 'Maximum error level'
attributes. Available only for nodeExited and
problemOccurred .
|
|
int getWarnings() |
Returns |
The total warning count for the node just exited. Only available for
nodeExited .
|
|
|
|
A de.qfs.apps.qftest.extensions.qftest.TestSuiteNode
is a representation
of a QF-Test node that is currently being executed, including information about the type
of node, its name, comment, etc.
|
|
|
JsonObject asJsonValue() |
Returns |
The object as JsonObject .
|
|
String getComment() |
Returns | Get the expanded comment of the node. |
|
String getComponentId() |
Returns | Get the expanded QF-Test ID of the component of the node. |
|
String getId() |
Returns | The ID of the node. |
|
String getName() |
Returns |
The name of the node or null if that type of node does not have a 'Name'
attribute.
|
|
String getReportName() |
Returns |
The expanded report name for 'Test-set' and 'Test-case' nodes. The normal
name for other nodes or null if undefined.
|
|
String getSuite() |
Returns | The full path of the test-suite to which the node belongs. |
|
String getTreeName() |
Returns |
The name of the node as displayed in the test-suite tree.
|
|
String getType() |
Returns |
The type of node, the last part of the name of the class implementing the node's
behavior.
|
|
|
|