public class DirectorySuiteBuilder
extends java.lang.Object
DirectorySuiteBuilder builder = new DirectorySuiteBuilder(); Test suite = builer.suite("/home/project/myproject/tests");Returns a suite containing all tests from files starting with "Sample" and ending with "Test". /home/project/myproject/tests
DirectorySuiteBuilder builder = new DirectorySuiteBuilder(); builder.setFilter(new TestFilter() { public boolean include(String classpath) { return super.include(classpath) && SimpleTestFilter.getClassName(classpath).startsWith("Sample"); } }); Test suite = builder.suite("/home/project/myproject/tests");
Constructor and Description |
---|
DirectorySuiteBuilder()
Constructs an empty DirectorySuiteBuilder object.
|
DirectorySuiteBuilder(TestFilter filter)
Constructs an DirectorySuiteBuilder object with the given filter.
|
Modifier and Type | Method and Description |
---|---|
protected java.util.List |
browse(java.io.File directory)
Returns the list of test classes contained in the directory.
|
protected boolean |
isTestClass(java.lang.String path)
Returns true if the given path refers a test class.
|
protected void |
merge(java.util.List classenames,
junit.framework.TestSuite suite)
Populates the suite with test cases extracted from the
classnames list.
|
void |
setFilter(TestFilter filter)
Sets the filter defining the test classes to be included.
|
junit.framework.Test |
suite(java.io.File directory)
Constructs a TestSuite by extracting all test classes from the
given directory.
|
junit.framework.Test |
suite(java.lang.String directoryName)
Constructs a TestSuite by extracting all test classes from the
directory of the given directoryName.
|
public DirectorySuiteBuilder()
public DirectorySuiteBuilder(TestFilter filter)
public junit.framework.Test suite(java.io.File directory) throws java.lang.Exception
java.lang.Exception
public junit.framework.Test suite(java.lang.String directoryName) throws java.lang.Exception
java.lang.Exception
protected java.util.List browse(java.io.File directory) throws java.lang.Exception
java.lang.Exception
AbstractSuiteBuilder.isTestClass(java.lang.String)
public void setFilter(TestFilter filter)
protected boolean isTestClass(java.lang.String path)
protected void merge(java.util.List classenames, junit.framework.TestSuite suite) throws java.lang.ClassNotFoundException, java.lang.IllegalAccessException, java.lang.reflect.InvocationTargetException
java.lang.ClassNotFoundException
java.lang.IllegalAccessException
java.lang.reflect.InvocationTargetException
Copyright © ${project.year} ${project.holder}. All Rights Reserved.