@API(status=STABLE,
since="1.0")
public class LauncherFactory
extends java.lang.Object
Launcher instances by invoking create()
or create(LauncherConfig).
By default, test engines are discovered at runtime using the
ServiceLoader mechanism. For that purpose, a
text file named META-INF/services/org.junit.platform.engine.TestEngine
has to be added to the engine's JAR file in which the fully qualified name
of the implementation class of the TestEngine
interface is declared.
By default, test execution listeners are discovered at runtime via the
ServiceLoader mechanism and are
automatically registered with the Launcher created by this factory.
Users may register additional listeners using the
Launcher.registerTestExecutionListeners(TestExecutionListener...)
method on the created launcher instance.
For full control over automatic registration and programmatic registration
of test engines and listeners, supply an instance of LauncherConfig
to create(LauncherConfig).
Launcher,
LauncherConfig| Modifier | Constructor and Description |
|---|---|
private |
LauncherFactory() |
@API(status=STABLE,
since="1.10")
public static LauncherSession openSession()
throws PreconditionViolationException
PreconditionViolationException - if no test engines are detectedopenSession(LauncherConfig)@API(status=STABLE,
since="1.10")
public static LauncherSession openSession(LauncherConfig config)
throws PreconditionViolationException
LauncherSession using the
supplied LauncherConfig.config - the configuration for the session and the launcher; never
nullPreconditionViolationException - if the supplied configuration is
null, or if no test engines are detectedopenSession()public static Launcher create() throws PreconditionViolationException
PreconditionViolationException - if no test engines are detectedcreate(LauncherConfig)@API(status=STABLE,
since="1.10")
public static Launcher create(LauncherConfig config)
throws PreconditionViolationException
Launcher using the supplied
LauncherConfig.config - the configuration for the launcher; never nullPreconditionViolationException - if the supplied configuration is
null, or if no test engines are detected
registeredcreate()private static DefaultLauncher createDefaultLauncher(LauncherConfig config, LauncherConfigurationParameters configurationParameters)
private static java.util.List<LauncherInterceptor> collectLauncherInterceptors(LauncherConfigurationParameters configurationParameters)
private static java.util.Set<TestEngine> collectTestEngines(LauncherConfig config)
private static LauncherSessionListener createLauncherSessionListener(LauncherConfig config)
private static java.util.List<PostDiscoveryFilter> collectPostDiscoveryFilters(LauncherConfig config)
private static void registerLauncherDiscoveryListeners(LauncherConfig config, Launcher launcher)
private static void registerTestExecutionListeners(LauncherConfig config, Launcher launcher, LauncherConfigurationParameters configurationParameters)
private static java.util.stream.Stream<TestExecutionListener> loadAndFilterTestExecutionListeners(ConfigurationParameters configurationParameters)