Interface TestEngine

    • Method Detail

      • getId

        java.lang.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 "junit-vintage" and "junit-jupiter", respectively. When in doubt, you may use the fully qualified name of your custom TestEngine implementation class.

      • getGroupId

        default java.util.Optional<java.lang.String> getGroupId​()
        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 simply returns an empty Optional, signaling that the group ID is unknown.

        Concrete test engine implementations may override this method in order to provide a known group ID.

        Returns:
        an Optional containing the group ID; never null but potentially empty if the group ID is unknown
        See Also:
        getArtifactId(), getVersion()
      • getArtifactId

        default java.util.Optional<java.lang.String> getArtifactId​()
        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 Package in which the engine resides. Note that a package only has attributes if the information is defined in the Manifest of the JAR containing that package, and if the class loader created the Package instance with the attributes from the manifest.

        If the implementation title cannot be queried from the package attributes, the default implementation simply returns an empty Optional.

        Concrete test engine implementations may override this method in order to determine the artifact ID by some other means.

        Returns:
        an Optional containing the artifact ID; never null but potentially empty if the artifact ID is unknown
        See Also:
        Class.getPackage(), Package.getImplementationTitle(), getGroupId(), getVersion()
        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.
      • getVersion

        default java.util.Optional<java.lang.String> getVersion​()
        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: "Engine-Version-" + getId()

        Then the default implementation attempts to query the implementation version from the package attributes for the Package in which the engine resides. Note that a package only has attributes if the information is defined in the Manifest of the JAR containing that package, and if the class loader created the Package instance with the attributes from the manifest.

        If the implementation version cannot be queried from the package attributes, the default implementation returns "DEVELOPMENT".

        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.

        Returns:
        an Optional containing the version; never null but potentially empty if the version is unknown
        See Also:
        Class.getPackage(), Package.getImplementationVersion(), getGroupId(), getArtifactId()