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 EngineDescriptorthe discovery request; never discoveryRequest, UniqueId nullthe unique ID to be used for this test engine's
uniqueId)TestDescriptor; never nullDiscover tests according to the supplied |
| public void | execute(ExecutionRequest
the request to execute tests for; never request)nullExecute tests according to the supplied |
| public default Optional | Returns: anOptional containing the module name or artifact ID; never
null but potentially empty if neither the module name nor the artifact
ID can be determinedGet the Module Name or 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 | Returns: the ID of this test engine; nevernull or blankGet the ID that uniquely identifies this test engine. |
| 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 Furthermore, implementations must publish events about test discovery
via 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 Module Name or 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 first attempts to retrieve the
name of the 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.
| |
| 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. The default implementation first attempts to retrieve the version
from the JAR manifest attribute named If the manifest attribute is not available, an attempt is made to retrieve
the raw version of the
If the module version is not available, an attempt is made to query the
implementation version
from the package attributes for the If the implementation version cannot be determined, the default
implementation returns Concrete test engine implementations may override this method to determine the version by some other means.
| |