Skip to main content

Utilities

There are different utilities that can help you to write your process test.

Manipulate the clock​

The Camunda runtime uses an internal clock to execute process instances and to calculate when a BPMN timer event is due. In a test, you can use CamundaProcessTestContext to manipulate the clock.

When to use it:

  • Trigger an active BPMN timer event
  • Test scenarios that require a specific date or time, for example, a leap year
@Test
void shouldTriggerTimerEvent() {
// given: a process instance waiting at a BPMN timer event

// when
assertThat(processInstance).hasActiveElements("Wait 2 days");

processTestContext.increaseTime(Duration.ofDays(2));

// then
assertThat(processInstance).hasCompletedElements("Wait 2 days");
}