I try to follow this example flowable-engine/modules/flowable-engine/src/test/java/org/flowable/examples/bpmn/executionlistener/ExecutionListenerTest.java at main · flowable/flowable-engine · GitHub to test a flow. This is my unit test.
@RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration(locations = {“/testApplicationContext.xml”})
public class TestWasCustomerUpdated extends PluggableFlowableTestCase {@Autowired private RuntimeService runtimeService; private String customerUID = "118045"; @Test public void simpleProcessTest() throws IOException, SOAPException { Map<String, Object> variables = new HashMap<String, Object>(); variables.put( Constants.CUSTOMER_UID, customerUID); ProcessInstance processInstance = runtimeService.startProcessInstanceByKey("checkCustomerFlow", variables); String varSetInExecutionListener = (String) runtimeService.getVariable(processInstance.getId(), Constants.IS_CUSTOMER_UPDATED); Assert.assertNotNull(varSetInExecutionListener); Assert.assertEquals("firstValue", varSetInExecutionListener); }
}
The flow runs all right, but at the line with “getVariable” I get
org.flowable.common.engine.api.FlowableObjectNotFoundException: execution 120001 doesn’t exist
The flow has ended and isn’t available any more to check on its results, or so it seems. Is there anything I can do to check the variables my flow has set after it ended?