@API(value=Experimental) public interface TestEngine
TestEngine
facilitates discovery and execution of
tests for a particular programming model.
For example, JUnit provides a TestEngine
that discovers and
executes tests written using the JUnit Jupiter programming model.
Every TestEngine
must provide its own unique ID,
discover tests from
EngineDiscoveryRequests
,
and execute those tests according to
ExecutionRequests
.
In order to facilitate test discovery within IDEs and tools prior
to launching the JUnit Platform, TestEngine
implementations are
encouraged to make use of the
@Testable
annotation.
For example, the @Test
and @TestFactory
annotations in JUnit
Jupiter are meta-annotated with @Testable
. Consult the Javadoc for
@Testable
for further details.
EngineDiscoveryRequest
,
ExecutionRequest
,
Testable
Modifier and Type | Method and Description |
---|---|
TestDescriptor |
discover(EngineDiscoveryRequest discoveryRequest,
UniqueId uniqueId)
Discover tests according to the supplied
EngineDiscoveryRequest . |
void |
execute(ExecutionRequest request)
Execute tests according to the supplied
ExecutionRequest . |
String |
getId()
Get the ID that uniquely identifies this test engine.
|
String getId()
Each test engine must provide a unique ID. JUnit Vintage and Jupiter
use "junit-vintage"
and "junit-jupiter"
, respectively.
When in doubt, you may use the fully qualified name of your custom
TestEngine
implementation class.
TestDescriptor discover(EngineDiscoveryRequest discoveryRequest, UniqueId uniqueId)
EngineDiscoveryRequest
.
The supplied UniqueId
must be used as the unique ID of the
returned root TestDescriptor
. In addition, the UniqueId
must be used to create unique IDs for children of the root's descriptor
by calling UniqueId.append(java.lang.String, java.lang.String)
.
discoveryRequest
- the discovery requestuniqueId
- the unique ID to be used for this test engine's
TestDescriptor
TestDescriptor
of this engine, typically an
instance of EngineDescriptor
EngineDescriptor
void execute(ExecutionRequest request)
ExecutionRequest
.
The request
passed to this method contains the root
TestDescriptor
that was previously returned by discover(org.junit.platform.engine.EngineDiscoveryRequest, org.junit.platform.engine.UniqueId)
,
the EngineExecutionListener
to be notified of test execution
events, and ConfigurationParameters
that may influence test execution.
request
- the request to execute tests for