Class ProcessEngineExtension

  • All Implemented Interfaces:
    ProcessEngineServices, org.junit.jupiter.api.extension.AfterAllCallback, org.junit.jupiter.api.extension.AfterTestExecutionCallback, org.junit.jupiter.api.extension.BeforeTestExecutionCallback, org.junit.jupiter.api.extension.Extension, org.junit.jupiter.api.extension.ParameterResolver, org.junit.jupiter.api.extension.TestInstancePostProcessor, org.junit.jupiter.api.extension.TestWatcher

    public class ProcessEngineExtension
    extends Object
    implements org.junit.jupiter.api.extension.TestWatcher, org.junit.jupiter.api.extension.TestInstancePostProcessor, org.junit.jupiter.api.extension.BeforeTestExecutionCallback, org.junit.jupiter.api.extension.AfterTestExecutionCallback, org.junit.jupiter.api.extension.AfterAllCallback, org.junit.jupiter.api.extension.ParameterResolver, ProcessEngineServices
    Junit 5 Extension to create and inject a ProcessEngine into the test class.

    If you provide a camunda.cfg.xml file on the classpath. This file is used to configure the process engine.
    Usage:

     @ExtendWith(ProcessEngineExtension.class)
     public class YourTest {
    
       // provide a property where the extension can inject the process engine
       public ProcessEngine processEngine;
    
       ...
     }
     

    If you want to choose the camunda.cfg.xml file that is used in the test programmatically, you can register the extension directly and use the builder pattern to configure it.
    Usage with configuration:

    Usage:

     @RegisterExtension
     ProcessEngineExtension extension = ProcessEngineExtension.builder()
        .configurationResource("myConfigurationFile.xml")
        .build();}
     

    You can declare a deployment with the Deployment annotation. This base class will make sure that this deployment gets deployed before the setUp and cascade deleted after the tearDown.

    If you need the history service for your tests then you can specify the required history level of the test method or class, using the RequiredHistoryLevel annotation. If the current history level of the process engine is lower than the specified one then the test is skipped.