Class RecursiveTestSuite
- java.lang.Object
-
- junit.framework.TestSuite
-
- com.gargoylesoftware.base.testing.RecursiveTestSuite
-
- All Implemented Interfaces:
junit.framework.Test
public class RecursiveTestSuite extends junit.framework.TestSuiteA 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 $
-
-
Field Summary
Fields Modifier and Type Field Description private TestFiltertestFilter_
-
Constructor Summary
Constructors Constructor Description RecursiveTestSuite(java.io.File startingPath, TestFilter testFilter)Create an instanceRecursiveTestSuite(java.lang.String startingPath, TestFilter testFilter)Create a new instance
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description private java.util.SetfindAllTestClasses(java.io.File startingDirectory)private voidfindAllTestClasses(java.io.File directory, java.util.List list)private junit.framework.TestgetTestForClass(java.lang.Class clazz)Return a test suite containing all the tests for the specified class.static voidmain(java.lang.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(java.lang.String startingPath, TestFilter testFilter) throws java.io.IOExceptionCreate a new instance- Parameters:
testFilter- The object that will filter out tests that we don't wish to runstartingPath- The directory that we will start our descent in.- Throws:
java.io.IOException- If anything goes wrong during the directory scanning.
-
RecursiveTestSuite
public RecursiveTestSuite(java.io.File startingPath, TestFilter testFilter) throws java.io.IOExceptionCreate an instance- Parameters:
testFilter- The object that will filter out tests that we don't wish to runstartingPath- The directory that we will start our descent in.- Throws:
java.io.IOException- If anything goes wrong during the directory scanning.
-
-
Method Detail
-
main
public static void main(java.lang.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.
-
getTestForClass
private junit.framework.Test getTestForClass(java.lang.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
-
findAllTestClasses
private java.util.Set findAllTestClasses(java.io.File startingDirectory) throws java.io.IOException- Parameters:
startingDirectory- Description of Parameter- Returns:
- Description of the Returned Value
- Throws:
java.io.IOException- Description of Exception
-
findAllTestClasses
private void findAllTestClasses(java.io.File directory, java.util.List list) throws java.io.IOException- Parameters:
directory- Description of Parameterlist- Description of Parameter- Throws:
java.io.IOException- Description of Exception
-
-