@Deployment public void testAutoStoreVariables() { // The first script should NOT store anything as 'autoStoreVariables' is set to false String id = runtimeService .startProcessInstanceByKey( "testAutoStoreVariables", CollectionUtil.map("a", 20, "b", 22)) .getId(); assertNull(runtimeService.getVariable(id, "sum")); // The second script, after the user task will set the variable taskService.complete(taskService.createTaskQuery().singleResult().getId()); assertEquals(42, ((Number) runtimeService.getVariable(id, "sum")).intValue()); }