com.gargoylesoftware.base.testing

Class RecursiveTestSuite

public class RecursiveTestSuite extends TestSuite

A launching point for executing test cases. This recusively walks through the directory structure looking for classes that end in Test.class. It then loads these classes to see if they are instances of TestCase. If so, they are added to the test suite. Once all directories have been scanned, the test cases are executed.

Version: $Revision: 1.3 $

Author: Mike Bowler

Field Summary
TestFiltertestFilter_
Constructor Summary
RecursiveTestSuite(String startingPath, TestFilter testFilter)
Create a new instance
RecursiveTestSuite(File startingPath, TestFilter testFilter)
Create an instance
Method Summary
SetfindAllTestClasses(File startingDirectory)
voidfindAllTestClasses(File directory, List list)
TestgetTestForClass(Class clazz)
Return a test suite containing all the tests for the specified class.
static voidmain(String[] args)
Main entry point.
voidtestFoo()
Dummy test so that JUnit doesn't complain that this suite doesn't have any tests.

Field Detail

testFilter_

private final TestFilter testFilter_

Constructor Detail

RecursiveTestSuite

public RecursiveTestSuite(String startingPath, TestFilter testFilter)
Create a new instance

Parameters: testFilter The object that will filter out tests that we don't wish to run startingPath The directory that we will start our descent in.

Throws: IOException If anything goes wrong during the directory scanning.

RecursiveTestSuite

public RecursiveTestSuite(File startingPath, TestFilter testFilter)
Create an instance

Parameters: testFilter The object that will filter out tests that we don't wish to run startingPath The directory that we will start our descent in.

Throws: IOException If anything goes wrong during the directory scanning.

Method Detail

findAllTestClasses

private Set findAllTestClasses(File startingDirectory)

Parameters: startingDirectory Description of Parameter

Returns: Description of the Returned Value

Throws: IOException Description of Exception

findAllTestClasses

private void findAllTestClasses(File directory, List list)

Parameters: directory Description of Parameter list Description of Parameter

Throws: IOException Description of Exception

getTestForClass

private Test getTestForClass(Class clazz)
Return a test suite containing all the tests for the specified class. If the class has a suite() method then it will be used to get the tests, otherwise reflection will be used.

Parameters: clazz Description of Parameter

Returns: The testSuiteForClass value

main

public static void main(String[] args)
Main entry point.

Parameters: args The arguments

testFoo

public void testFoo()
Dummy test so that JUnit doesn't complain that this suite doesn't have any tests.