things.testing.unit
Class TestGroup

java.lang.Object
  extended by things.testing.unit.TestGroup
Direct Known Subclasses:
DeadGroup

public abstract class TestGroup
extends java.lang.Object

UNIT testing tool. An group of tests. Collect test suites with this. You can flag whether to throw exceptions on aborts or fails (both are on by default). Aborts will always be thrown before fails, even if a condition would cause both (such as an initialization or framework problem).

Version:
1.0

Version History

EPG - Initial - 1 AUG 04
 
Author:
Erich P. Gatejen

Field Summary
 int abort
           
 int exception
           
 int fail
           
 java.lang.String groupLongName
           
 java.lang.String groupName
           
 int inconclusive
           
 StringPoster logger
           
 int pass
           
 ThingsPropertyView properties
           
 Result result
           
 java.lang.String runnerName
           
 long time
           
 int total
           
 long totalSize
           
 
Constructor Summary
TestGroup()
           
 
Method Summary
 void DECLAREGROUP(java.lang.String name, java.lang.String className)
          DECLARE a group.
 void DECLARETEST(java.lang.String name, java.lang.String className)
          DECLARE a test.
 void execute()
          Run this group
 java.lang.String getLongName()
          Get the long name of this group.
 java.lang.String getName()
          Get the name of this group
abstract  void group_execute()
          Run the group.
abstract  void group_prepare()
          prepare for the group run.
 void prepare(java.lang.String runnerNaming, java.lang.String givenName, ResultExpresser expresserIn, StringPoster logIn, ThingsPropertyView view, int inDepth)
          Init this group
 Result RUN(java.lang.String name)
          Run a test class as named.
 void RUNGROUP(java.lang.String name)
          Run a test class as named.
 void SET_LONG_NAME(java.lang.String name)
          Set the long name for this group.
 void SET_THROW_ABORTS(boolean flag)
          Set the Throw Exception on Test Aborts on (true) or off(false).
 void SET_THROW_FAILS(boolean flag)
          Set the Throw Exception on Test Fail on (true) or off(false).
 void THE_BUCK_STOPS_HERE()
          Don't let any throws or aborts escape.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

groupName

public java.lang.String groupName

groupLongName

public java.lang.String groupLongName

properties

public ThingsPropertyView properties

runnerName

public java.lang.String runnerName

logger

public StringPoster logger

total

public int total

time

public long time

pass

public int pass

fail

public int fail

abort

public int abort

inconclusive

public int inconclusive

exception

public int exception

totalSize

public long totalSize

result

public Result result
Constructor Detail

TestGroup

public TestGroup()
Method Detail

group_prepare

public abstract void group_prepare()
                            throws java.lang.Throwable
prepare for the group run.

Throws:
java.lang.Throwable

group_execute

public abstract void group_execute()
                            throws java.lang.Throwable
Run the group. Overload this with the group implementation.

Throws:
java.lang.Throwable

THE_BUCK_STOPS_HERE

public void THE_BUCK_STOPS_HERE()
Don't let any throws or aborts escape. this is a top-level grouping. The default is the exact opposite. This can be called in group_prepare() or group_execute().


SET_THROW_FAILS

public void SET_THROW_FAILS(boolean flag)
Set the Throw Exception on Test Fail on (true) or off(false). This can be called in group_prepare() or group_execute().

Parameters:
flag - true is on, false is off

SET_THROW_ABORTS

public void SET_THROW_ABORTS(boolean flag)
Set the Throw Exception on Test Aborts on (true) or off(false). This can be called in group_prepare() or group_execute().

Parameters:
flag - true is on, false is off

SET_LONG_NAME

public void SET_LONG_NAME(java.lang.String name)
Set the long name for this group. This can be useful for more information.

Parameters:
name - the long name as a string.

DECLARETEST

public void DECLARETEST(java.lang.String name,
                        java.lang.String className)
                 throws ThingsException
DECLARE a test. This should be called by group_prepare() to define the various tests. They will then be RUN() in the group_execute().

Parameters:
name - the name of the test. It should be unique.
className - the name of the class that implements this test.
Throws:
ThingsException

DECLAREGROUP

public void DECLAREGROUP(java.lang.String name,
                         java.lang.String className)
                  throws ThingsException
DECLARE a group. This should be called by group_prepare() to define the various tests. They will then be RUN() in the group_execute().

Parameters:
name - the name of the group. It should be unique.
className - the name of the class that implements this group.
Throws:
ThingsException

RUN

public Result RUN(java.lang.String name)
           throws ThingsException
Run a test class as named.

Parameters:
name - of the class to run
Returns:
the result
Throws:
ThingsException

RUNGROUP

public void RUNGROUP(java.lang.String name)
              throws ThingsException
Run a test class as named.

Parameters:
name - of the class to run
Throws:
ThingsException

getName

public java.lang.String getName()
                         throws ThingsException
Get the name of this group

Returns:
the name of this group
Throws:
ThingsException

getLongName

public java.lang.String getLongName()
                             throws ThingsException
Get the long name of this group.

Returns:
the name of this group
Throws:
ThingsException

prepare

public void prepare(java.lang.String runnerNaming,
                    java.lang.String givenName,
                    ResultExpresser expresserIn,
                    StringPoster logIn,
                    ThingsPropertyView view,
                    int inDepth)
             throws ThingsException
Init this group

Parameters:
runnerNaming - is the name giving to the test run by the running agent
givenName - the name given to this group.
expresserIn - is the ResultExpresser to use.
logIn - is a StringPoster for logging.
view - is a properties view that will be avaible to the test implementation
inDepth - the depth of this group.
Throws:
ThingsException
See Also:
ThingsPropertyView

execute

public void execute()
             throws java.lang.Throwable
Run this group

Throws:
ThingsException
java.lang.Throwable


Things.