ZeebeSpringTest: Is it possible to check process-variables?

Hi guys,

a quick question, we are doing some testing with Camunda 8 and ZeebeSpringTest (see code below). Is there a way, that we can also can check the contents of the variables that we put in the process when we complete a ServiceTask?

When we complete our ServiceTask, we add a variable “personOnboardingResponse” and in the main-test-method we would also like to verify the contents of this variable. Is that possible? I tried to get the variable via the event, but this does not have a method for it. Is that possible some other way?

void testExecution() throws IOException, InterruptedException, TimeoutException, JSONException {

    ProcessInstanceEvent event = client.newCreateInstanceCommand()
            .variables(new FileInputStream("src/test/resources/request.json"))

    ProcessInstanceAssert assertions = BpmnAssert.assertThat(event);
    completeServiceTasks("generateDummyResponseDataWorker", 1);
    completeServiceTasks("endSubprocessWorker", 1);


private void completeServiceTasks(final String jobType, final int count)
        throws InterruptedException, TimeoutException {

    final var activateJobsResponse =

    final int activatedJobCount = activateJobsResponse.getJobs().size();
    if (activatedJobCount < count) {
                "Unable to activate %d jobs, because only %d were activated."
                        .formatted(count, activatedJobCount));

    ObjectMapper mapper = new ObjectMapper();
    ObjectNode rootNode = mapper.createObjectNode();
    ObjectNode childNode1 = mapper.createObjectNode();
    childNode1.put("name1", "val1");
    childNode1.put("name2", "val2");
    rootNode.set("personOnboardingResponse", childNode1);

    for (int i = 0; i < count; i++) {
        final var job = activateJobsResponse.getJobs().get(i);


Hi @the-villain - I think what you’re looking for is the hasVariableWithValue assertion. You can find an example of it here.