Package jadex.base.test
Class ComponentTestSuite
- java.lang.Object
-
- junit.framework.TestSuite
-
- jadex.base.test.ComponentTestSuite
-
- All Implemented Interfaces:
IAbortableTestSuite
,junit.framework.Test
public class ComponentTestSuite extends junit.framework.TestSuite implements IAbortableTestSuite
Execute multiple component tests in a test suite.
-
-
Field Summary
Fields Modifier and Type Field Description boolean
aborted
Indicate when the suite is aborted due to excessive run time.protected java.lang.ClassLoader
classloader
The class loader.protected IExternalAccess
platform
The platform.static boolean
SAME_PLATFORM
Run all tests on the same platform.protected long
timeout
The timeout (if any).protected java.util.Timer
timer
The timeout timer (if any).
-
Constructor Summary
Constructors Constructor Description ComponentTestSuite(java.io.File[][] roots, java.lang.String[] tests, java.lang.String[] excludes)
Create a component test suite for components contained in a given path.ComponentTestSuite(java.io.File[][] roots, java.lang.String[] tests, java.lang.String[] excludes, boolean test, boolean load, boolean start)
Create a component test suite for components contained in a given path.ComponentTestSuite(java.lang.String[] excludes)
Create a component test suite for components contained in class directories on the class path (i.e. not jars).ComponentTestSuite(java.lang.String[] args, java.io.File[][] roots, java.lang.String[] tests, java.lang.String[] excludes, boolean runtests, boolean load, boolean start)
Create a component test suite for components contained in a given path.ComponentTestSuite(java.lang.String projectDir, java.lang.String[] excludes, boolean includeTestClasses)
Create a component test suite for components contained in a given path.ComponentTestSuite(java.lang.String projectDir, java.lang.String[] tests, java.lang.String[] excludes, boolean includeTestClasses)
Create a component test suite for components contained in a given path.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description protected void
cleanup(junit.framework.TestResult result)
Called after test suite is finished.static void
clearAWT()
Workaround for AWT/Swing memory leaks.protected static void
collectClasspathDirectories(java.lang.ClassLoader classloader, java.util.Set<java.io.File> set)
Collect all directory URLs belonging to a class loader.static java.io.File[][]
findClassDirectories()
Find class directories on classpath.protected java.util.List<java.lang.String>
getAllFiles(java.io.File root)
java.lang.ClassLoader
getClassLoader()
Get the class loader.boolean
isAborted()
Indicate when the suite is aborted due to excessive run time.void
run(junit.framework.TestResult result)
Overridden for pre and post code.protected void
startTimer()
protected void
stopTimer()
-
-
-
Field Detail
-
SAME_PLATFORM
public static final boolean SAME_PLATFORM
Run all tests on the same platform.- See Also:
- Constant Field Values
-
aborted
public boolean aborted
Indicate when the suite is aborted due to excessive run time.
-
platform
protected IExternalAccess platform
The platform.
-
classloader
protected java.lang.ClassLoader classloader
The class loader.
-
timeout
protected long timeout
The timeout (if any).
-
timer
protected java.util.Timer timer
The timeout timer (if any).
-
-
Constructor Detail
-
ComponentTestSuite
public ComponentTestSuite(java.lang.String[] excludes) throws java.lang.Exception
Create a component test suite for components contained in class directories on the class path (i.e. not jars).- Parameters:
excludes
- Files to exclude (if a pattern is contained in file path).- Throws:
java.lang.Exception
-
ComponentTestSuite
public ComponentTestSuite(java.lang.String projectDir, java.lang.String[] excludes, boolean includeTestClasses) throws java.lang.Exception
Create a component test suite for components contained in a given path.- Parameters:
projectDir
- The project directory.excludes
- Files to exclude (if a pattern is contained in file path).- Throws:
java.lang.Exception
-
ComponentTestSuite
public ComponentTestSuite(java.lang.String projectDir, java.lang.String[] tests, java.lang.String[] excludes, boolean includeTestClasses) throws java.lang.Exception
Create a component test suite for components contained in a given path.- Parameters:
projectDir
- The project directory.tests
- The tests (full qualified names) to include. Includes all, if null.excludes
- Files to exclude (if a pattern is contained in file path).- Throws:
java.lang.Exception
-
ComponentTestSuite
public ComponentTestSuite(java.io.File[][] roots, java.lang.String[] tests, java.lang.String[] excludes) throws java.lang.Exception
Create a component test suite for components contained in a given path.- Parameters:
roots
- The paths to search for testcases in and to load classes from.tests
- The tests (full qualified names) to include. Includes all, if null.excludes
- Files to exclude (if a pattern is contained in file path).- Throws:
java.lang.Exception
-
ComponentTestSuite
public ComponentTestSuite(java.io.File[][] roots, java.lang.String[] tests, java.lang.String[] excludes, boolean test, boolean load, boolean start) throws java.lang.Exception
Create a component test suite for components contained in a given path.- Parameters:
roots
- The paths to search for testcases in and to load classes from.tests
- The tests (full qualified names) to include. Includes all, if null.excludes
- Files to exclude (if a pattern is contained in file path).test
- Run test components.load
- Include broken components (will cause test failure if any). Also shows loadable, but not startable components as succeeded tests.start
- Try starting components, which are no test cases.- Throws:
java.lang.Exception
-
ComponentTestSuite
public ComponentTestSuite(java.lang.String[] args, java.io.File[][] roots, java.lang.String[] tests, java.lang.String[] excludes, boolean runtests, boolean load, boolean start) throws java.lang.Exception
Create a component test suite for components contained in a given path.- Parameters:
args
- The platform arguments.roots
- The paths to search for testcases in and to load classes from. Grouped by project, e.g. proj1/build/classes and proj1/build/resources should be both at index [0] of this array.tests
- The tests (full qualified names) to include. Includes all, if null.excludes
- Files to exclude (if a pattern is contained in file path).runtests
- Run test components.load
- Include broken components (will cause test failure if any).start
- Try starting components, which are no test cases.- Throws:
java.lang.Exception
-
-
Method Detail
-
startTimer
protected void startTimer()
-
stopTimer
protected void stopTimer()
-
getAllFiles
protected java.util.List<java.lang.String> getAllFiles(java.io.File root)
-
isAborted
public boolean isAborted()
Indicate when the suite is aborted due to excessive run time.- Specified by:
isAborted
in interfaceIAbortableTestSuite
-
run
public void run(junit.framework.TestResult result)
Overridden for pre and post code.- Specified by:
run
in interfacejunit.framework.Test
- Overrides:
run
in classjunit.framework.TestSuite
-
cleanup
protected void cleanup(junit.framework.TestResult result)
Called after test suite is finished.
-
clearAWT
public static void clearAWT()
Workaround for AWT/Swing memory leaks.
-
getClassLoader
public java.lang.ClassLoader getClassLoader()
Get the class loader.
-
findClassDirectories
public static java.io.File[][] findClassDirectories()
Find class directories on classpath.
-
collectClasspathDirectories
protected static void collectClasspathDirectories(java.lang.ClassLoader classloader, java.util.Set<java.io.File> set)
Collect all directory URLs belonging to a class loader.
-
-