I’ve been looking at the FlowableMockSupport class and it looks like I might be able to easily make a mock service task using the annotation @MockServiceTask, but I just need a little guidance.
Can I mock a processTask using that annotation just by giving its id, and how do I define the mock’s behavior, since my real process does some work, then returns a set of “out” parameters?
Apologies if this is a FAQ or noob question.
Correct me if I am not right,
FlowableMockSupport is implemented in the process engine and you want to mock processTask in the CMMN engine. AFAIK mock service task support is not implemented in the CMMN engine. It should not be so hard to implement. Default CmmnActivityBehaviorFactory should be wrapped into BehaviorFactory which will provide mocking (similar as
That is correct.
Also, @MockServiceTask was an experiment and never really documented as such.
@joram - Thanks for the input. Is the @MockServiceTask a direction that is not going to be pursued in the future?
Personally, I think there is a need for some mocking capability, because I have had “unit tests” of top-level BPMN processes that depended on all the sub-processes called by it, both directly and indirectly. When one sub-process’ tests break, all the tests up the calling chain tend to break. Also, the top-level tests are very brittle, because they have to set up all the conditions that enable all the sub-level process tests to run. I am now working on a project where we envision a collection of BPMN processes, all driven from top-level CMMN cases. It would be great to be able to mock the sub-cases and sub-processes that get called, without needing to use the real implementations.