Class AbstractTestCase<T extends AbstractTestCase<?>>

java.lang.Object
org.camunda.community.bpmndt.api.AbstractTestCase<T>
Type Parameters:
T - The generated test case type.
Direct Known Subclasses:
AbstractJUnit5TestCase

public abstract class AbstractTestCase<T extends AbstractTestCase<?>> extends Object
Abstract superclass for test cases.
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
     
    protected Class<?>
    The related test class - must be provided by the concrete implementation.
    protected String
    The test method, which will be executed - must be provided by the concrete implementation.
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    protected void
    Performs the teardown for a test case execution.
    protected void
    Performs the setup for a test case execution by creating a TestCaseInstance and deploying the related BPMN resources.
    protected org.camunda.bpm.engine.ProcessEngine
    Builds the process engine, used to execute the test case.
    Creates a new executor, used to specify variables, business key and/or mocks that are considered during test case execution.
    protected abstract void
    execute(org.camunda.bpm.engine.runtime.ProcessInstance pi)
    Executes the test case.
    protected InputStream
    Returns an input stream that provides the BPMN resource with the process definition to be tested - either this method or getBpmnResourceName() must be overridden!
    protected String
    Returns the name of the BPMN resource, that provides the process definition to be tested - either this method or getBpmnResource() must be overridden!
    Returns the ID of the process definition deployment.
    abstract String
    Returns the ID of the test case's end activity.
    abstract String
    Returns the key of the process definition that is tested.
    org.camunda.bpm.engine.ProcessEngine
    Returns the process engine, used to execute the test case.
    protected List<org.camunda.bpm.engine.impl.cfg.ProcessEnginePlugin>
    Provides custom ProcessEnginePlugins to be registered when the process engine is built.
    abstract String
    Returns the ID of the test case's start activity.
    protected boolean
    Determines if the test case's end activity ends the process or not.
    protected boolean
    Determines if Spring based testing is enabled or not.
    withTenantId(String tenantId)
    Sets the tenant ID to be used for the automatic process definition deployment.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

    • testClass

      protected Class<?> testClass
      The related test class - must be provided by the concrete implementation.
    • testMethodName

      protected String testMethodName
      The test method, which will be executed - must be provided by the concrete implementation.
    • instance

      protected TestCaseInstance instance
  • Constructor Details

    • AbstractTestCase

      public AbstractTestCase()
  • Method Details

    • beforeEach

      protected void beforeEach()
      Performs the setup for a test case execution by creating a TestCaseInstance and deploying the related BPMN resources. This method must be invoked before each test!
    • afterEach

      protected void afterEach()
      Performs the teardown for a test case execution. This method must be invoked after each test!
    • buildProcessEngine

      protected org.camunda.bpm.engine.ProcessEngine buildProcessEngine()
      Builds the process engine, used to execute the test case. The method registers custom ProcessEnginePlugins as well as the BpmndtProcessEnginePlugin, which is required to configure a conform process engine.
      Returns:
      The newly created process engine.
    • createExecutor

      public TestCaseExecutor createExecutor()
      Creates a new executor, used to specify variables, business key and/or mocks that are considered during test case execution. After the specification, TestCaseExecutor.execute() is called to create a new ProcessInstance and execute the test case.
      Returns:
      The newly created executor.
    • execute

      protected abstract void execute(org.camunda.bpm.engine.runtime.ProcessInstance pi)
      Executes the test case.
      Parameters:
      pi - A process instance, created especially for the test case.
    • getBpmnResource

      protected InputStream getBpmnResource()
      Returns an input stream that provides the BPMN resource with the process definition to be tested - either this method or getBpmnResourceName() must be overridden!
      Returns:
      The BPMN resource as stream.
    • getBpmnResourceName

      protected String getBpmnResourceName()
      Returns the name of the BPMN resource, that provides the process definition to be tested - either this method or getBpmnResource() must be overridden!
      Returns:
      The BPMN resource name, within src/main/resources.
    • getDeploymentId

      public String getDeploymentId()
      Returns the ID of the process definition deployment.
      Returns:
      The deployment ID.
    • getEnd

      public abstract String getEnd()
      Returns the ID of the test case's end activity.
      Returns:
      The end activity ID.
    • getProcessDefinitionKey

      public abstract String getProcessDefinitionKey()
      Returns the key of the process definition that is tested.
      Returns:
      The process definition key.
    • getProcessEngine

      public org.camunda.bpm.engine.ProcessEngine getProcessEngine()
      Returns the process engine, used to execute the test case.
      Returns:
      The process engine.
    • getProcessEnginePlugins

      protected List<org.camunda.bpm.engine.impl.cfg.ProcessEnginePlugin> getProcessEnginePlugins()
      Provides custom ProcessEnginePlugins to be registered when the process engine is built. By default, this method return an empty list. It can be overridden by any extending class.
      Returns:
      A list of process engine plugins to register.
      See Also:
    • getStart

      public abstract String getStart()
      Returns the ID of the test case's start activity.
      Returns:
      The start activity ID.
    • isSpringEnabled

      protected boolean isSpringEnabled()
      Determines if Spring based testing is enabled or not. This method returns false, if not overridden.
      Returns:
      true, if the testing is Spring based. Otherwise false.
    • isProcessEnd

      protected boolean isProcessEnd()
      Determines if the test case's end activity ends the process or not. This is the case if the activity is an end event and if the activity's parent scope is the process. This method returns true, if not overridden.
      Returns:
      true, if the test case's end activity ends the process. Otherwise false.
    • withTenantId

      public T withTenantId(String tenantId)
      Sets the tenant ID to be used for the automatic process definition deployment.
      Parameters:
      tenantId - A specific tenant ID.
      Returns:
      The test case.