- java.lang.Object
-
- org.junit.platform.launcher.core.LauncherFactory
-
@API(status=STABLE, since="1.0") public class LauncherFactory extends Object
Factory for creatingLauncher
instances by invokingcreate()
orcreate(LauncherConfig)
.By default, test engines are discovered at runtime using the
ServiceLoader
mechanism. For that purpose, a text file namedMETA-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 theTestEngine
interface is declared.By default, test execution listeners are discovered at runtime via the
ServiceLoader
mechanism and are automatically registered with theLauncher
created by this factory. Users may register additional listeners using theLauncher.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
tocreate(LauncherConfig)
.- Since:
- 1.0
- See Also:
Launcher
,LauncherConfig
-
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static Launcher
create()
Factory method for creating a newLauncher
using automatic registration for test engines and test execution listeners.static Launcher
create(LauncherConfig config)
Factory method for creating a newLauncher
using the suppliedLauncherConfig
.
-
-
-
Method Detail
-
create
public static Launcher create() throws PreconditionViolationException
Factory method for creating a newLauncher
using automatic registration for test engines and test execution listeners.- Throws:
PreconditionViolationException
- if no test engines are detected- See Also:
create(LauncherConfig)
-
create
@API(status=EXPERIMENTAL, since="1.3") public static Launcher create(LauncherConfig config) throws PreconditionViolationException
Factory method for creating a newLauncher
using the suppliedLauncherConfig
.- Parameters:
config
- the configuration for the launcher; nevernull
- Throws:
PreconditionViolationException
- if the supplied launcher configuration isnull
, or if no test engines are detected or registered- Since:
- 1.3
- See Also:
create()
-
-