ma.glasnost.orika.test
Class DynamicSuite
java.lang.Object
org.junit.runner.Runner
org.junit.runners.ParentRunner<org.junit.runner.Runner>
ma.glasnost.orika.test.DynamicSuite
- All Implemented Interfaces:
- org.junit.runner.Describable, org.junit.runner.manipulation.Filterable, org.junit.runner.manipulation.Sortable
public class DynamicSuite
- extends org.junit.runners.ParentRunner<org.junit.runner.Runner>
DynamicSuite resolves and runs a test suite dynamically containing all
classes matched by a specified pattern.
Use the @RunWith annotation, specifying DyanimcSuite.class as
the value in order to run a test class as a dynamic suite.
The pattern may be customized by specifying an value with the
TestCasePattern annotation.
The tests may also be run as a "scenario" by marking the class with the
@Scenario annotation. Running tests as a scenario will cause all
of the resolved test cases' methods to be suffixed with the scenario name.
This is necessary in case you want to run these tests again, under a new
"scenario", since normally, JUnit attempts to avoid running the same test
method more than once.
The JUnit 4+ @BeforeClass and @AfterClass
annotations may used to define setup and tear-down methods to be performed
before and after the entire suite, respectively.
- Author:
- matt.deboer@gmail.com
|
Nested Class Summary |
static interface |
DynamicSuite.Scenario
The Scenario annotation is used to mark the dynamic suite
with a specific name that should be appended to each executed test name. |
static interface |
DynamicSuite.TestCasePattern
The TestCasePattern annotation specifies the pattern from
which test case classes should be matched. |
|
Method Summary |
protected org.junit.runner.Description |
describeChild(org.junit.runner.Runner child)
|
static List<Class<?>> |
findTestCases(Class<?> theClass)
Resolves the test classes that are matched by the specified test pattern. |
static List<Class<?>> |
findTestCases(File classFolder,
String testCaseRegex)
Resolves the test classes that are matched by the specified test pattern. |
protected List<org.junit.runner.Runner> |
getChildren()
|
protected String |
getName()
|
protected void |
runChild(org.junit.runner.Runner runner,
org.junit.runner.notification.RunNotifier notifier)
|
| Methods inherited from class org.junit.runners.ParentRunner |
childrenInvoker, classBlock, collectInitializationErrors, filter, getDescription, getTestClass, run, setScheduler, sort, validatePublicVoidNoArgMethods, withAfterClasses, withBeforeClasses |
| Methods inherited from class org.junit.runner.Runner |
testCount |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
DynamicSuite
public DynamicSuite(Class<?> klass,
org.junit.runners.model.RunnerBuilder builder)
throws org.junit.runners.model.InitializationError
- Throws:
org.junit.runners.model.InitializationError
DynamicSuite
public DynamicSuite(org.junit.runners.model.RunnerBuilder builder,
Class<?>[] classes)
throws org.junit.runners.model.InitializationError
- Throws:
org.junit.runners.model.InitializationError
DynamicSuite
protected DynamicSuite(Class<?> klass,
Class<?>[] suiteClasses)
throws org.junit.runners.model.InitializationError
- Throws:
org.junit.runners.model.InitializationError
DynamicSuite
protected DynamicSuite(org.junit.runners.model.RunnerBuilder builder,
Class<?> klass,
Class<?>[] suiteClasses)
throws org.junit.runners.model.InitializationError
- Throws:
org.junit.runners.model.InitializationError
DynamicSuite
protected DynamicSuite(Class<?> klass,
List<org.junit.runner.Runner> runners)
throws org.junit.runners.model.InitializationError
- Throws:
org.junit.runners.model.InitializationError
findTestCases
public static List<Class<?>> findTestCases(Class<?> theClass)
- Resolves the test classes that are matched by the specified test pattern.
- Parameters:
theClass - the root class which defines the DynamicSuite; the
@TestCasePattern annotation will be used to
determine the pattern of test cases to include, and the root
folder will be determined based on the root folder for the
class-loader of theClass. -
- Returns:
findTestCases
public static List<Class<?>> findTestCases(File classFolder,
String testCaseRegex)
- Resolves the test classes that are matched by the specified test pattern.
- Parameters:
classFolder - the root folder under which to search for test casestestCaseRegex - the pattern to use when looking for test cases to include;
send null to use the value annotated on the class designated
by the class parameter.
- Returns:
getName
protected String getName()
- Overrides:
getName in class org.junit.runners.ParentRunner<org.junit.runner.Runner>
getChildren
protected List<org.junit.runner.Runner> getChildren()
- Specified by:
getChildren in class org.junit.runners.ParentRunner<org.junit.runner.Runner>
describeChild
protected org.junit.runner.Description describeChild(org.junit.runner.Runner child)
- Specified by:
describeChild in class org.junit.runners.ParentRunner<org.junit.runner.Runner>
runChild
protected void runChild(org.junit.runner.Runner runner,
org.junit.runner.notification.RunNotifier notifier)
- Specified by:
runChild in class org.junit.runners.ParentRunner<org.junit.runner.Runner>
Copyright © 2012 Glasnost. All Rights Reserved.