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.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 $
  • Field Details

    • testFilter_

      private final TestFilter testFilter_
  • Constructor Details

    • RecursiveTestSuite

      public RecursiveTestSuite(String startingPath, TestFilter testFilter) throws IOException
      Create a new instance
      Parameters:
      startingPath - The directory that we will start our descent in.
      testFilter - The object that will filter out tests that we don't wish to run
      Throws:
      IOException - If anything goes wrong during the directory scanning.
    • RecursiveTestSuite

      public RecursiveTestSuite(File startingPath, TestFilter testFilter) throws IOException
      Create an instance
      Parameters:
      startingPath - The directory that we will start our descent in.
      testFilter - The object that will filter out tests that we don't wish to run
      Throws:
      IOException - If anything goes wrong during the directory scanning.
  • Method Details

    • 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.
    • getTestForClass

      private junit.framework.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
    • findAllTestClasses

      private Set findAllTestClasses(File startingDirectory) throws IOException
      Parameters:
      startingDirectory - Description of Parameter
      Returns:
      Description of the Returned Value
      Throws:
      IOException - Description of Exception
    • findAllTestClasses

      private void findAllTestClasses(File directory, List list) throws IOException
      Parameters:
      directory - Description of Parameter
      list - Description of Parameter
      Throws:
      IOException - Description of Exception