Version: 0.25

Writing Tests

You can use the zeebe-test module to write JUnit tests for your job worker and BPMN workflow. It provides a JUnit rule to bootstrap the broker and some basic assertions.

Usage in a Maven project#

Add zeebe-test as Maven test dependency to your project:


Bootstrap the Broker#

Use the ZeebeTestRule in your test case to start an embedded broker. It contains a client which can be used to deploy a BPMN workflow or create an instance.

import io.zeebe.client.ZeebeClient;
import io.zeebe.client.api.response.WorkflowInstanceEvent;
import org.junit.Before;
import org.junit.Rule;
import org.junit.Test;
public class MyTest {
@Rule public final ZeebeTestRule testRule = new ZeebeTestRule();
private ZeebeClient client;
public void test() {
client = testRule.getClient();
final WorkflowInstanceEvent workflowInstance =

Verify the Result#

The ZeebeTestRule provides also some basic assertions in AssertJ style. The entry point of the assertions is ZeebeTestRule.assertThat(...).

final WorkflowInstanceEvent workflowInstance = ...
.hasPassed("start", "task", "end")
.hasVariable("result", 21.0);