zeebeTestEngine.increaseTime not working reliably for Spring Boot Tests


I have a process test whose process includes an timer intermediate catch event with a duration of 15 minutes. Obviously, I don’t want the test to wait but want be be able to trigger the timer (or rather increase the time of the environment so that it fires).

Here is a nice working example which works: TimerTest.java

However, this previous example uses @ZeebeProcessTest and in my case I have
@SpringBootTest @ZeebeSpringTest and it doesn’t work reliably.

To reproduce the issue I created a fork of the Camunda 8 Twitter Example: twitter-with-timer in which I

  • added a timer with a duration in the process model
  • added the same skipTimer implementation.
  • disabled all tests but the first (to make it simpler)

However, this test

  • sometimes fails on the first zeebeTestEngine.waitForIdleState(DEFAULT)
  • sometimes on the last zeebeTestEngine.waitForIdleState(DEFAULT)
  • sometimes it succeeds.

Why? How can zeebeTestEngine.increaseTime be used reliably together with a Spring Boot test?


Hi @Zelldon, hi @pihme, hi @jonathan.lukas ,

I’m tagging you here hoping you can support or know who to ask instead :slight_smile:


Hello @tobiasschaefer ,

this could be related to this: [Backport stable/8.4] Timer events fail with specific values by backport-action · Pull Request #1070 · camunda/zeebe-process-test · GitHub


Thanks @jonathan.lukas

the issue #1070 seems unrelated to me because it is a different scenario: "Appears only when there is a long-lived and a short-lived timer. This is very specific use-case. Therefore, impact is small.

In my case the timers fire in a real execution and also in zeebe-process-test. Its “only” a Spring Boot related issue when using @ZeebeSpringTest that the test fails.


Hi @tobiasschaefer ,

do you have a stacktrace?
It would be interesting to see where the test fails.


Hi @jonathan.lukas ,

I replaced @Test with @RepeatedTest(10).

This is the result:

Repetition 1: failed on “zeebeTestEngine.waitForIdleState(DEFAULT);” (first line in method skipTimeout) with a timeout

Repetition 2: failed a few lines later on
“zeebeTestEngine.waitForIdleState(DEFAULT);” (last (!) line in method skipTimeout) with a timeout

Repetition 4 failed with “Mockito.verify(twitterService).tweet(“Hello world”);”

On the second invocation all 10 were successful:

On further invocations I get random results similar to the first and second invocation.

Note that the duration is quite different. I don’t know much about Zeebe internals but is there some configuration which can be set to make the timers being checked more often?

To reproduce this please checkout GitHub - tobiasschaefer/camunda-8-examples at twitter-with-timer (already posted above). I just added another commit to switch to 10 repetitions to make it easier to analyze.

Interesting! These tests should run more stable :melting_face:.

Could you please create an issue in the github repo?

@jonathan.lukas : I just saw that the original working tests in “timer-testing” are from you :slight_smile:

I created the issue spring-zeebe#659 which describes the issue when running in Spring Boot.

I’d love to see this issue get fixed.

ok lets check this .

1 Like