class TestReport
extends java.lang.Object
implements java.io.Serializable
This class contains fields and convenience methods related to the result of
running a single test. It is used internally by Series
to pass
test results. For failed tests, it is returned in SeriesReport
objects.
Modifier and Type | Field and Description |
---|---|
private FatalError |
cleanup_stop_cause
Reason for test cleanup failure, or
null if the test was
cleaned up successfully. |
private java.lang.Throwable |
stop_cause
Reason for test failure, or
null if the test was
successful. |
private java.lang.String |
task
Task message when the test failed, or
null if there was no
task message, or the test was successful. |
private java.lang.Class<? extends Test> |
test_class
Test class.
|
Constructor and Description |
---|
TestReport(java.lang.Class<? extends Test> test_class,
java.lang.Throwable stop_cause,
FatalError cleanup_stop_cause)
Creates a
TestReport object. |
Modifier and Type | Method and Description |
---|---|
(package private) boolean |
fatal()
Returns
true if and only if the test stopped with a fatal
error, or cleanup stopped with any error (all cleanup erros are fatal). |
(package private) void |
print(java.io.PrintStream stream)
Prints a report for a failed test.
|
(package private) boolean |
successful()
Returns
true if and only if the test was successful: if
both the test stop cause and the cleanup stop cause are
null . |
private final java.lang.Class<? extends Test> test_class
private final java.lang.Throwable stop_cause
null
if the test was
successful.private final java.lang.String task
null
if there was no
task message, or the test was successful.private final FatalError cleanup_stop_cause
null
if the test was
cleaned up successfully.TestReport(java.lang.Class<? extends Test> test_class, java.lang.Throwable stop_cause, FatalError cleanup_stop_cause)
TestReport
object.
If stop_cause
is wrapped in a FailedDuringTask
object, it is unwrapped, and the task noted in the task
field.
boolean successful()
true
if and only if the test was successful: if
both the test stop cause and the cleanup stop cause are
null
.boolean fatal()
true
if and only if the test stopped with a fatal
error, or cleanup stopped with any error (all cleanup erros are fatal).void print(java.io.PrintStream stream)
The test name is printed. If the main test failed, then the reason for the failure is printed. The task being performed during the failure is shown, if there was one. If the failure was not a timeout, the stack trace is shown as well. If the cleanup task failed, a description of the error and a stack trace are printed.
stream
- Stream to receive the formatted test report.