Class AbstractTestCase

java.lang.Object
org.camunda.community.bpmndt.api.AbstractTestCase
Direct Known Subclasses:
AbstractJUnit5TestCase

public abstract class AbstractTestCase extends Object
Abstract superclass for test cases.
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    protected void
    Performs the setup for a test case execution by initializing all element handlers.
    createExecutor(io.camunda.zeebe.process.test.api.ZeebeTestEngine engine)
    Creates a new executor, used to specify variables that are considered during test case execution.
    protected abstract void
    execute(TestCaseInstance instance, long processInstanceKey)
    Executes the test case.
    abstract String
    Returns the ID of the BPMN process that is tested.
    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!
    abstract String
    Returns the ID of the test case's end activity.
    protected String
    Returns the BPMN resource used to simulate arbitrary sub processes.
    abstract String
    Returns the ID of the test case's start element.
    protected boolean
    Determines if the test case's start element is a message start event or not.
    protected boolean
    Determines if the test case's start element starts the process or not.
    protected boolean
    Determines if the test case's start element is a signal start event or not.
    protected boolean
    Determines if the test case's start element is a timer start event or not.

    Methods inherited from class java.lang.Object

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

    • AbstractTestCase

      public AbstractTestCase()
  • Method Details

    • beforeEach

      protected void beforeEach()
      Performs the setup for a test case execution by initializing all element handlers. This method must be invoked before each test!
    • createExecutor

      public TestCaseExecutor createExecutor(io.camunda.zeebe.process.test.api.ZeebeTestEngine engine)
      Creates a new executor, used to specify variables that are considered during test case execution. After the specification, TestCaseExecutor.execute() is called to create a new process instance and execute the test case.
      Parameters:
      engine - The Zeebe test engine to use.
      Returns:
      The newly created executor.
    • execute

      protected abstract void execute(TestCaseInstance instance, long processInstanceKey)
      Executes the test case.
      Parameters:
      instance - The test case instance to use.
      processInstanceKey - The key of the related process instance, created during the start of the test case.
    • getBpmnProcessId

      public abstract String getBpmnProcessId()
      Returns the ID of the BPMN process that is tested.
      Returns:
      The BPMN process ID.
    • 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.
    • getEnd

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

      protected String getSimulateSubProcessResource()
      Returns the BPMN resource used to simulate arbitrary sub processes. This method must be overridden, since the default implementation relies on a classpath resource, which is not available when a concrete test case is executed.
      Returns:
      The simulate sub process BPMN as string.
    • getStart

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

      protected boolean isMessageStart()
      Determines if the test case's start element is a message start event or not. This method returns false, if not overridden.
      Returns:
      true, if the test case's start element is a message start event. Otherwise false.
    • isProcessStart

      protected boolean isProcessStart()
      Determines if the test case's start element starts the process or not. This is the case if the BPMN element is a start event and if the element's parent scope is the process. This method returns true, if not overridden.
      Returns:
      true, if the test case's start element starts the process. Otherwise false.
    • isSignalStart

      protected boolean isSignalStart()
      Determines if the test case's start element is a signal start event or not. This method returns false, if not overridden.
      Returns:
      true, if the test case's start element is a signal start event. Otherwise false.
    • isTimerStart

      protected boolean isTimerStart()
      Determines if the test case's start element is a timer start event or not. This method returns false, if not overridden.
      Returns:
      true, if the test case's start element is a timer start event. Otherwise false.