Copyright 2002 by aragost

com.aragost.junit
Class Util

java.lang.Object
  |
  +--com.aragost.junit.Util

public class Util
extends java.lang.Object


Constructor Summary
Util()
           
 
Method Summary
static void addTests(TestSuite suite, java.io.File root)
          Iterate over all TestCasess found in the jar file or directory specified, and add them to the specified TestSuite.
static TestSuite createJarTest(java.lang.Class cls)
          Create a Test with all the TestCasess found in the same "library" as the specified Class.
static TestSuite createJarTest(java.io.File root)
          Create a Test with all the TestCasess found in the jar file specified.
static boolean isConcreteTestCaseClass(java.lang.Class cls)
          Check if the specified is a non-abstract public JUnit TestCase class.
static void run(java.lang.Class testClass, java.lang.String[] arguments)
          Run the specified test class.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Util

public Util()
Method Detail

createJarTest

public static TestSuite createJarTest(java.io.File root)
Create a Test with all the TestCasess found in the jar file specified. A directory can also be specified.

It will scan a jar file or subdirectory test cases and create a TestSuite with these tests.

Test method can be extremely useful to run all Tests for s specific project. You don't have to create a AllTests class and manually keep it up to date.

Parameters:
root - Where to search for TestCases
Returns:
TestSuite with all TestCases under the root

createJarTest

public static TestSuite createJarTest(java.lang.Class cls)
Create a Test with all the TestCasess found in the same "library" as the specified Class. By "library" is meant jar or a file system directory.

Parameters:
cls - Class in the library to create a Test for.
Returns:
TestSuite with all TestCases in the same library as the specified Class
See Also:
createJarTest(File)

addTests

public static void addTests(TestSuite suite,
                            java.io.File root)
Iterate over all TestCasess found in the jar file or directory specified, and add them to the specified TestSuite.

Parameters:
suite - TestSuite to add the tests to
root - Where to search for TestCases

isConcreteTestCaseClass

public static boolean isConcreteTestCaseClass(java.lang.Class cls)
Check if the specified is a non-abstract public JUnit TestCase class.

Parameters:
cls - Class to check
Returns:
true if the specified class is a concrete TestCase class

run

public static void run(java.lang.Class testClass,
                       java.lang.String[] arguments)
Run the specified test class. An '-r' (or '--runner') option can be specified, it must be either 'swing', 'awt', or 'text'. If another value is specified a RuntimeException is thrown.

Parameters:
testClass - The test class to run.!
arguments - The arguments for the runner.
Throws:
java.lang.RuntimeException - If arguments are illegal

Copyright 2002 by aragost