Class JmcTestEngine

java.lang.Object
org.mpi_sws.jmc.integrations.junit5.engine.JmcTestEngine
All Implemented Interfaces:
org.junit.platform.engine.TestEngine

public class JmcTestEngine extends Object implements org.junit.platform.engine.TestEngine
A custom JUnit 5 test engine for running JMC tests.

This engine discovers and executes tests annotated with JmcCheck or JmcCheckConfiguration in the classpath, packages, or specific classes.

  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    org.junit.platform.engine.TestDescriptor
    discover(org.junit.platform.engine.EngineDiscoveryRequest request, org.junit.platform.engine.UniqueId uniqueId)
    Discovers tests based on the provided discovery request and unique ID.
    void
    execute(org.junit.platform.engine.ExecutionRequest request)
    Executes the discovered tests in the JMC test engine.
     

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

    Methods inherited from interface org.junit.platform.engine.TestEngine

    getArtifactId, getGroupId, getVersion
  • Constructor Details

    • JmcTestEngine

      public JmcTestEngine()
  • Method Details

    • getId

      public String getId()
      Specified by:
      getId in interface org.junit.platform.engine.TestEngine
    • discover

      public org.junit.platform.engine.TestDescriptor discover(org.junit.platform.engine.EngineDiscoveryRequest request, org.junit.platform.engine.UniqueId uniqueId)
      Discovers tests based on the provided discovery request and unique ID.

      This method scans the classpath, packages, and specific classes for JMC tests annotated with JmcCheck or JmcCheckConfiguration. It creates a test descriptor for the JMC test engine and adds discovered tests as children of the engine descriptor.

      Specified by:
      discover in interface org.junit.platform.engine.TestEngine
      Parameters:
      request - The discovery request containing selectors for classpath roots, packages, and classes.
      uniqueId - The unique ID for the test engine descriptor.
      Returns:
      A TestDescriptor representing the discovered tests in the JMC test engine.
    • execute

      public void execute(org.junit.platform.engine.ExecutionRequest request)
      Executes the discovered tests in the JMC test engine.

      This method starts the execution of the root test descriptor and recursively executes all child descriptors, handling any exceptions that may occur during execution.

      Specified by:
      execute in interface org.junit.platform.engine.TestEngine
      Parameters:
      request - The execution request containing the root test descriptor and engine execution listener.