|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--org.suiterunner.Suite
A suite consisting of zero to many test methods and zero to many
sub-Suite
s.
Signature of test methods in subclasses must be one of:
public void testX(); public void testX(Reporter v);where
X
is some unique, hopefully meaningful, string.
Constructor Summary | |
Suite()
Construct a new Suite object with no sub-Suite s. |
|
Suite(java.util.List subSuites)
Create a new Suite object with passed sub-Suite s. |
Method Summary | |
void |
addSubSuite(Suite subSuite)
Append the Suite passed as subSuite to the end of
this Suite object's list of sub-Suite s. |
void |
clearSubSuites()
Clear this object's list of sub- Suite s. |
void |
execute(Reporter reporter)
Execute this suite object. |
protected void |
executeSubSuites(Reporter reporter)
Execute zero to many of this suite object's sub- Suite s. |
protected void |
executeTestMethods(Reporter reporter)
Execute zero to many of this suite object's test methods. |
static void |
fail()
Throws TestFailedException to indicate a test failed. |
static void |
fail(java.lang.String message)
Throws TestFailedException , with the passed
String message as the exception's detail
message, to indicate a test failed. |
static void |
fail(java.lang.String message,
java.lang.Throwable cause)
Throws TestFailedException , with the passed
String message as the exception's detail
message and Throwable cause, to indicate a test failed. |
static void |
fail(java.lang.Throwable cause)
Throws TestFailedException , with the passed
Throwable cause, to indicate a test failed. |
java.util.List |
getSubSuites()
Get an unmodifiable List of this Suite object's sub-Suite s. |
java.lang.String |
getSuiteName()
Get a user-friendly suite name for this Suite object. |
int |
getTestCount()
Get the total number of tests that are expected to run when this suite object's execute method is invoked. |
java.lang.String |
getTestName(java.lang.String testMethodName)
Get a user-friendly test name for this Suite object's test method, whose
simple String name is passed as testMethodName . |
static boolean |
isStopRequested()
Gets the boolean stopRequested property. |
static void |
setStopRequested(boolean stopRequested)
Sets the stopRequested property to the specified boolean value. |
void |
setUpFixture()
Setup the test fixture for this object's test methods. |
void |
tearDownFixture()
Cleanup the test fixture for this object's test methods. |
static void |
verify(boolean condition)
Verify that a boolean condition is true. |
static void |
verify(boolean condition,
java.lang.String message)
Verify that a boolean condition, described in String
message , is true. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
public Suite()
Suite
object with no sub-Suite
s.public Suite(java.util.List subSuites)
Suite
object with passed sub-Suite
s.
The suite name of this Suite
object will be the fully qualified name of this
object's class.subSuites
- A List
of Suite
objects. The specified List
must be non-empty. Each element must be non-null
and an instance
of org.suiterunner.Suite
.NullPointerException
- if subSuites
is null
or any element of subSuites
set is null
.java.lang.IllegalArgumentException
- if subSuites is empty or if any non-null
element of
subSuites
set is not an instance of
org.suiterunner.Suite
.Method Detail |
public void execute(Reporter reporter)
This class's implementation of this method calls these two methods on this object in this order:
executeTestMethods(reporter)
executeSubSuites(reporter)
reporter
- the Reporter
to which results will be reportedNullPointerException
- if reporter
is null
.protected void executeTestMethods(Reporter reporter)
This class's implementation of this method uses reflection to discover all methods of the appropriate signature and invokes each one. The appropriate signature for test methods is:
Signature of test methods in subclasses must be one of:
public void testX(); public void testX(Reporter v);where
X
is some unique, hopefully meaningful, string.reporter
- the Reporter
to which results will be reportedNullPointerException
- if reporter
is null
.protected void executeSubSuites(Reporter reporter)
Suite
s.
This class's
implementation of this method invokes execute
on each
sub-Suite
passed to this class's constructor or added via the addSubSuite
method.
reporter
- the Reporter
to which results will be reportedNullPointerException
- if reporter
is null
.public java.lang.String getSuiteName()
Suite
object. This class's
implementation of this method returns the simple name of this object's class. This
class's implementation of executeSubSuites
calls this method to obtain a
name for Report
s to pass to the suiteStarting
, suiteCompleted
,
and suiteAborted
methods of the Reporter
.Suite
object's suite name.public java.lang.String getTestName(java.lang.String testMethodName)
Suite
object's test method, whose
simple String
name is passed as testMethodName
. This class's
implementation of this method returns the concatenation of the simple name of this object's
class, a dot, and the specified String
testMethodName
. This
class's implementation of executeTestMethods
calls this method to obtain a
name for Report
s to pass to the testStarting
, testSucceeded
,
and testFailed
methods of the Reporter
.Suite
object.NullPointerException
- if testMethodName
is null
public int getTestCount()
execute
method is invoked.
This class's implementation of this method returns the sum of:
public void testX()
or the public void testX(Reporter)
signature declared in this object's class
getTestCount
on every sub-Suite
contained in
this suite object.
public void setUpFixture()
executeTestMethods
invokes setUpFixture
before invoking
each test method.public void tearDownFixture()
executeTestMethods
invokes tearDownFixture
after
each test method.public static void verify(boolean condition)
TestFailedException
.condition
- the boolean condition to verifyTestFailedException
- if verification fails.public static void verify(boolean condition, java.lang.String message)
String
message
, is true.
If verification succeeds, returns normally.
If verification fails, throws TestFailedException
with
specified message
as the exception's detail message.condition
- the boolean condition to verifymessage
- A message describing the failure.TestFailedException
- if verification fails.NullPointerException
- if message
is null
.public static void fail()
TestFailedException
to indicate a test failed.public static void fail(java.lang.String message)
TestFailedException
, with the passed
String
message
as the exception's detail
message, to indicate a test failed.message
- A message describing the failure.NullPointerException
- if message
is null
public static void fail(java.lang.String message, java.lang.Throwable cause)
TestFailedException
, with the passed
String
message
as the exception's detail
message and Throwable
cause, to indicate a test failed.message
- A message describing the failure.cause
- A Throwable
that indicates the cause of the failure.NullPointerException
- if message
or cause
is null
public static void fail(java.lang.Throwable cause)
TestFailedException
, with the passed
Throwable
cause, to indicate a test failed.
The getMessage
method of the thrown TestFailedException
will return cause.toString()
.cause
- A Throwable
that indicates the cause of the failure.NullPointerException
- if cause
is null
public void addSubSuite(Suite subSuite)
Suite
passed as subSuite
to the end of
this Suite
object's list of sub-Suite
s.subSuite
- the sub-Suite
to addNullPointerException
- if subSuite
is null
.public java.util.List getSubSuites()
List
of this Suite
object's sub-Suite
s.public void clearSubSuites()
Suite
s.public static boolean isStopRequested()
boolean
stopRequested property. Call this method
to determine whether a running test should stop. The execute
method of any Suite
, or
code invoked by execute
, should periodically check the
stopRequested property. If true
,
the execute
method should interrupt its work and simply return.public static void setStopRequested(boolean stopRequested)
boolean
value. Call this method
to request that a running test stop. The execute
method of any Suite
, or
code invoked by execute
, should periodically check the
stopRequested property. If true
,
the execute
method should interrupt its work and simply return.
|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |