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.
org.junit.platform.engine.EngineDiscoveryRequest
, org.junit.platform.engine.ExecutionRequest
, org.junit.platform.commons.annotation.Testable
Modifier and Type | Method and Description |
---|---|
public TestDescriptor | Returns: the rootTestDescriptor of this engine, typically an
instance of EngineDescriptor the discovery request; never discoveryRequest, UniqueId null the unique ID to be used for this test engine's
uniqueId)TestDescriptor ; never null Discover tests according to the supplied |
public void | execute(ExecutionRequest
the request to execute tests for; never request)null Execute tests according to the supplied |
public default Optional | Returns: anOptional containing the artifact ID; never
null but potentially empty if the artifact ID is unknownGet the Artifact ID of the JAR in which this test engine is packaged. |
public default Optional | Returns: anOptional containing the group ID; never null
but potentially empty if the group ID is unknownGet the Group ID of the JAR in which this test engine is packaged. |
public String | |
public default Optional | Returns: anOptional containing the version; never null
but potentially empty if the version is unknownGet the version of this test engine. |
discover | back to summary |
---|---|
public TestDescriptor discover(EngineDiscoveryRequest discoveryRequest, UniqueId uniqueId) Discover tests according to the supplied The supplied
|
execute | back to summary |
---|---|
public void execute(ExecutionRequest request) Execute tests according to the supplied The
|
getArtifactId | back to summary |
---|---|
public default Optional Get the Artifact ID of the JAR in which this test engine is packaged. This information is used solely for debugging and reporting purposes. The default implementation assumes the implementation title is equivalent
to the artifact ID and therefore attempts to query the
implementation title
from the package attributes for the If the implementation title cannot be queried from the package
attributes, the default implementation returns an empty
Concrete test engine implementations may override this method in order to determine the artifact ID by some other means. Implementation Note Since JUnit Platform version 1.1 this default implementation returns the "module name" stored in the module (modular jar on the module-path) of this test engine.
|
getGroupId | back to summary |
---|---|
public default Optional Get the Group ID of the JAR in which this test engine is packaged. This information is used solely for debugging and reporting purposes. The default implementation returns an empty Concrete test engine implementations may override this method in order to provide a known group ID.
|
getId | back to summary |
---|---|
public String getId() Get the ID that uniquely identifies this test engine. Each test engine must provide a unique ID. For example, JUnit Vintage
and JUnit Jupiter use |
getVersion | back to summary |
---|---|
public default Optional Get the version of this test engine. This information is used solely for debugging and reporting purposes. Initially, the default implementation tries to retrieve the engine
version from the manifest attribute named: Then the default implementation attempts to query the
implementation version
from the package attributes for the If the implementation version cannot be queried from the package
attributes, the default implementation returns Concrete test engine implementations may override this method to determine the version by some other means. implNote: Since JUnit Platform version 1.1 this default implementation honors the "raw version" information stored in the module (modular jar on the module-path) of this test engine.
|