How to build a unit test to get and complete a "Receive Task action"

Hi community, I’m trying to build a unit test to get and complete a task of type “Receive task”. I tried to get the task using task() but object is null. Also I could confirm my process is stuck a the Receive task using assertThat(processInstance).isWaitingAt(“my_receive_task”);

How can I get this task and complete ?

@devBunny can you provide the test case and the bpmn model for which you’re trying?

1 Like

Hi @devBunny,

you have to write

runtimeService.createMessageCorrelation("your message name").correlate();

to deliver the expected message and continue with the process instance.

Hope this helps, Ingo

4 Likes

Thank you very much

Thanks for the attention, It’s a simple scenario where I have a service task and receive task. Solution from @Ingo_Richtsmeier solved my problem.