|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.sun.javatest.lib.MultiStatus
public class MultiStatus
When executing multiple test cases in the same test class, it is usually easier for each test case to return a Status object representing whether that individual test case passed or failed. However, combining those individual Status objects into one Status object to represent the overall Status of the tests executed can be difficult. This test library is designed to solve the problem of generating an aggregate or overall Status from multiple Status objects. The static method overallStatus is designed to take an array of Status objects from individual test cases and generate a Status object that correctly reflects the overall status of all the individual the test cases executed.
The rule for how MultiStatus calculates the overall Status of an array of Status objects is based on the following precedence:
If any of the test cases return a Status.FAILED, then the overall status is Status.FAILED.
If all test cases return Status.PASSED, then the overall status is Status.PASSED.
If at least one test case returns either a null Status or some other Status, the overall status is Status.FAILED.
For an example of how to use this library see the UmbrellaTest library or the JCK test case: tests/api/java_lang/Double/SerializeTests.html.
Constructor Summary | |
---|---|
MultiStatus()
Create a MultiStatus object to accumulate individual Status objects. |
|
MultiStatus(java.io.PrintWriter out)
Create a MultiStatus object to accumulate individual Status objects. |
Method Summary | |
---|---|
void |
add(java.lang.String testID,
Status status)
Add another test result into the set for consideration. |
Status |
getStatus()
Get the aggregate outcome of all the outcomes passed to "add". |
int |
getTestCount()
Get the number of individual test results that have been added. |
static Status |
overallStatus(java.lang.String[] testIDs,
Status[] status)
Generates a Status object that reflects an array of Status objects. |
static Status |
overallStatus(java.lang.String[] testIDs,
Status[] status,
java.io.PrintWriter out)
Generates a Status object that reflects an array of Status objects. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public MultiStatus()
public MultiStatus(java.io.PrintWriter out)
out
- A stream to which the report the outcome of the tests.
If the stream is null, no reporting is done.Method Detail |
---|
public int getTestCount()
public void add(java.lang.String testID, Status status)
testID
- A name for this test case. Should not be null.status
- The outcome of this test casepublic Status getStatus()
public static Status overallStatus(java.lang.String[] testIDs, Status[] status, java.io.PrintWriter out)
testIDs
- an array of names used to identify the individual test cases.status
- an array of Status objects giving the outcomes of the individual test cases.out
- a PrintWriter that can be used to output the individual test case
status values. If null, no output is generated.
public static Status overallStatus(java.lang.String[] testIDs, Status[] status)
testIDs
- an array of names used to identify the individual test cases.status
- an array of Status objects giving the outcomes of the individual test cases.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |