|
Java DTV API 1.3 18-Nov-2009 |
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.sun.dtv.test.Report
public class Report
Embodies the result of a test: a code, a reference to the test and a related reason.
Field Summary | |
---|---|
static int |
ERROR
A report type indicating that the test was not run because some error occurred before the test could even be attempted. |
static int |
FAILED
A report type indicating that the test was executed but the test reported that it failed. |
static int |
NOT_RUN
A report type indicating that the test has not yet been run in this context. |
protected static int |
NUM_STATES
Number of report types which are predefined as "constants". |
static int |
PASSED
A report type indicating that the test was executed and was successful. |
static int |
UNRESOLVED
A report type indicating that the test has produced indecisive results. |
Constructor Summary | |
---|---|
Report(int type,
TestCase test,
String reason)
Create a Report object. |
Method Summary | |
---|---|
static Report |
error(TestCase test,
String reason)
Create a Report to indicate that an error occurred while trying to run a test: i.e. the test did not complete for some reason, and so it could not determine whether what was being tested passed or failed. |
void |
exit()
Convenience exit() function for the main() of
tests to exit in such a way that the report passes up across process
boundaries without losing information, that is: exit codes don't give
the associated text of the report and return codes when exceptions are
thrown could cause unintended results. |
static Report |
failed(TestCase test,
String reason)
Create a Report to indicate the unsuccessful outcome of a test: i.e. the test completed, but the test determined that what was being tested did not pass the test. |
int |
getType()
Get the type code indicating the type of this Report object. |
boolean |
isError()
Check if the type code of the report is ERROR. |
boolean |
isFailed()
Check if the type code of the report is FAILED. |
boolean |
isNotRun()
Check if the type code of the report is NOT_RUN. |
boolean |
isPassed()
Check if the type code of the report is PASSED. |
boolean |
isUnresolved()
Check if the type code of the report is UNRESOLVED. |
static Report |
notRun(TestCase test,
String reason)
Create a Report to indicate that the test has not yet been run. |
static Report |
passed(TestCase test,
String reason)
Create a Report to indicate the successful outcome of a test. |
String |
toString()
Convert a Report to a string. |
static Report |
unresolved(TestCase test,
String reason)
Create a Report to indicate that the test has produced indecisive results. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
public static final int PASSED
passed(com.sun.dtv.test.TestCase, java.lang.String)
,
getType()
,
Constant Field Valuespublic static final int FAILED
failed(com.sun.dtv.test.TestCase, java.lang.String)
,
getType()
,
Constant Field Valuespublic static final int ERROR
getType()
,
Constant Field Valuespublic static final int NOT_RUN
getType()
,
Constant Field Valuespublic static final int UNRESOLVED
getType()
,
Constant Field Valuesprotected static final int NUM_STATES
Constructor Detail |
---|
public Report(int type, TestCase test, String reason) throws NullPointerException, IllegalArgumentException
passed(TestCase, String)
,
failed(TestCase, String)
, error(TestCase, String)
etc. for more convenient factory methods to create
Report objects. Every time a new report is created, it
must be automatically logged in the
output stream defined to by TestHarness.log
. The
format is defined to be the return value of toString()
appended with a carriage return (CR) character.
type
- The type code for the Report object.test
- The corresponding test TestCase
object.reason
- A short string to store in the report. Unprintable
characters (i.e. outside the range 040C to 177C) in the string are
replaced by a space.
NullPointerException
- if test
or
reason
is null
.
IllegalArgumentException
- if the specified type is invalid.Method Detail |
---|
public int getType()
PASSED
,
FAILED
,
ERROR
,
NOT_RUN
,
UNRESOLVED
public boolean isPassed()
passed(com.sun.dtv.test.TestCase, java.lang.String)
,
getType()
,
PASSED
public boolean isFailed()
failed(com.sun.dtv.test.TestCase, java.lang.String)
,
getType()
,
FAILED
public boolean isError()
error(com.sun.dtv.test.TestCase, java.lang.String)
,
getType()
,
ERROR
public boolean isNotRun()
notRun(com.sun.dtv.test.TestCase, java.lang.String)
,
getType()
,
NOT_RUN
public boolean isUnresolved()
unresolved(com.sun.dtv.test.TestCase, java.lang.String)
,
getType()
,
UNRESOLVED
public static Report passed(TestCase test, String reason)
test
- The test TestCase
object that passed.reason
- A short string describing why the test passed.
public static Report failed(TestCase test, String reason)
test
- The test TestCase
object that failed.reason
- A short string describing why the test failed.
public static Report error(TestCase test, String reason)
test
- The test TestCase
object that had an error.reason
- A short string describing the error that occurred.
public static Report notRun(TestCase test, String reason)
test
- The test TestCase
object that did not run.reason
- A short string indicating why the test has not yet
been run.
public static Report unresolved(TestCase test, String reason)
test
- The test TestCase
object.reason
- A short string indicating why the test has not yet
been run.
public String toString()
TestCase.getTestId()
) and the reason on a space separated line.
toString
in class Object
public void exit()
exit()
function for the main()
of
tests to exit in such a way that the report passes up across process
boundaries without losing information, that is: exit codes don't give
the associated text of the report and return codes when exceptions are
thrown could cause unintended results.
An identifying marker is written to the error stream, which the script running the test watches for as the last output before returning, followed by the type and reason.
The method does not return. Typically this method would call
System.exit
with a value dependent on the type.
|
Java DTV API 1.3 18-Nov-2009 |
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |