Hi,
We have several flow which which we used to test in two phases.
phase one - each activity individually
phase two - all the flow in functional tests.
for phase one we used to have a bpmn with start_event → Activity → end_event
then we copy it to the complete flow.
This approach was proved to be very problematic and now we have allot of code that needs refactoring.
We don’t use Spring boot and this is the best solution I found for starting the flow at a certain activity:
@Rule
public ProcessEngineRule processEngineRule =
TestCoverageProcessEngineRuleBuilder.create().build();
@Test
@Deployment(resources = "flow.bpmn")
private ProcessInstance runCamundaActivity() {
RuntimeService runtimeService = processEngineRule.getRuntimeService();
return runtimeService.createProcessInstanceByKey("flowId")
.startBeforeActivity("activityId")
.setVariables(Utils.initializeVariables())
.executeWithVariablesInReturn();
}
This was somewhat transparent and easy way to refactor our tests. However when the activity is in the beginning of the flow there’s no way to mark the activity to stop. So the unit test actually runs until the end of the flow.
for the process builder there’s only startBeforeActivity and startAfterActivity but no stopAfterActivity.
what’s the best way to go about it?
Is there a way to tell the flow to stop after the activity ends?
Best Regards,
Itamar