org.ceryle.test
Class ApplicationTestSuite

java.lang.Object
  extended by java.lang.Thread
      extended by org.ceryle.test.ApplicationTestSuite
All Implemented Interfaces:
Runnable

public class ApplicationTestSuite
extends Thread

Creates a test suite from the Groovy scripts found in the directory set by the PROP_TEST_ROOT System property. This property must be set for the tests to begin; there is no default.

This encapsulates a Groovy/JUnit AllTestSuite class with error messaging both sent to Log4J and passed back to the application by getMessages(). The constructor also permits an optional ActionListener to receive notification that the tests are complete.

To Do

Ideally, the test selection feature would display a tree view of the available tests (based on the directory structure of the test suite. Selecting the trunk would run all tests, selecting a branch would run all tests within that branch, or running a single test.

Author:
Murray Altheim

Nested Class Summary
 
Nested classes/interfaces inherited from class java.lang.Thread
Thread.State, Thread.UncaughtExceptionHandler
 
Field Summary
static String PROP_TEST_ROOT
          The name of property containing the path to the root of the Groovy/JUnit test harness tree.
static String TEST_PATTERN
          The value of the the filename pattern for collection of Test Cases.
 
Fields inherited from class java.lang.Thread
MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY
 
Constructor Summary
ApplicationTestSuite(ActionListener listener)
          Constructor with an optional ActionListener, which will receive an ActionEvent upon completion of the tests.
 
Method Summary
 StringBuffer getMessages()
          Returns the StringBuffer containing any generated error messages.
 junit.framework.TestSuite getTests()
          Returns the test suite to be run, as generated from AllTestSuite.
 void run()
          Because this is a top-level test, this method is not part of the JUnit API, nor does it take any parameters.
 void setTests(junit.framework.TestSuite suite)
          Sets the TestSuite to be run.
 boolean successful()
          Returns true if the tests ran and were all successful.
 
Methods inherited from class java.lang.Thread
activeCount, checkAccess, countStackFrames, currentThread, destroy, dumpStack, enumerate, getAllStackTraces, getContextClassLoader, getDefaultUncaughtExceptionHandler, getId, getName, getPriority, getStackTrace, getState, getThreadGroup, getUncaughtExceptionHandler, holdsLock, interrupt, interrupted, isAlive, isDaemon, isInterrupted, join, join, join, resume, setContextClassLoader, setDaemon, setDefaultUncaughtExceptionHandler, setName, setPriority, setUncaughtExceptionHandler, sleep, sleep, start, stop, stop, suspend, toString, yield
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

PROP_TEST_ROOT

public static final String PROP_TEST_ROOT
The name of property containing the path to the root of the Groovy/JUnit test harness tree. The value is "http://purl.org/ceryle/prop/#test-root".

See Also:
Constant Field Values

TEST_PATTERN

public static final String TEST_PATTERN
The value of the the filename pattern for collection of Test Cases. The value is "**/*Test.groovy".

See Also:
Constant Field Values
Constructor Detail

ApplicationTestSuite

public ApplicationTestSuite(ActionListener listener)
                     throws ProcessException
Constructor with an optional ActionListener, which will receive an ActionEvent upon completion of the tests.

Throws:
ProcessException - if unable to set up the test suite
Method Detail

getTests

public junit.framework.TestSuite getTests()
Returns the test suite to be run, as generated from AllTestSuite. I.e., if the suite has not been explicitly set, the entire suite is returned.


setTests

public void setTests(junit.framework.TestSuite suite)
Sets the TestSuite to be run. Setting this to null will run all tests.


successful

public boolean successful()
Returns true if the tests ran and were all successful.


getMessages

public StringBuffer getMessages()
Returns the StringBuffer containing any generated error messages.


run

public void run()
Because this is a top-level test, this method is not part of the JUnit API, nor does it take any parameters. This begins scanning for *Test.groovy files within the source tree.

Specified by:
run in interface Runnable
Overrides:
run in class Thread


The Ceryle Project. Copyright ©2001-2007 Murray Altheim, All Rights Reserved. See LICENSE included with distribution.