
com.googlecode.junittoolbox.ParallelSuite Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of junit-toolbox Show documentation
Show all versions of junit-toolbox Show documentation
Useful classes for writing automated tests with JUnit
package com.googlecode.junittoolbox;
import org.junit.runners.model.InitializationError;
import org.junit.runners.model.RunnerBuilder;
/**
* An extension of the {@link WildcardPatternSuite} runner, which executes
* its children classes concurrently. You can specify the maximum number
* of parallel test threads using the system property maxParallelTestThreads
.
* If this system property is not specified, the maximum number of test threads
* will be the number of {@link Runtime#availableProcessors() available processors.}
* You can either explicitly list the children classes using the
* {@link org.junit.runners.Suite.SuiteClasses @SuiteClasses}
annotation
* provided by JUnit itself, like this:
* @RunWith(ParallelSuite.class)
* @SuiteClasses({
* LoginFrontendTest.class,
* FillOutFormFrontendTest.class,
* ...
* })
* public class AllFrontendTests {}
*
* Or you can specify a wildcard pattern using the {@link com.googlecode.junittoolbox.SuiteClasses @SuiteClasses}
annotation
* provided by JUnit Toolbox:
* @RunWith(ParallelSuite.class)
* @SuiteClasses("**/*FrontendTest.class")
* public class AllFrontendTests {}
*
* Note: Even if a test class annotated with @RunWith(ParallelSuite.class)
* has a child class, which is also annotated with @RunWith(ParallelSuite.class)
* or with @RunWith(ParallelRunner.class)
, there will never be
* more test threads than specified (or the number of available processors), because
* ParallelSuite
and {@link ParallelRunner}
share a singleton
* fork join pool.
*/
public class ParallelSuite extends WildcardPatternSuite {
public ParallelSuite(Class> klass, RunnerBuilder builder) throws InitializationError {
super(klass, builder);
setScheduler(new ParallelScheduler());
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy