All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.googlecode.junittoolbox.ParallelSuite Maven / Gradle / Ivy

The newest version!
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 - 2024 Weber Informatics LLC | Privacy Policy