Execute single task inside process


Let’s say that I have modeled a process like this one:


All tasks are ServiceTasks with JavaDelegate code. Is it possible, through Java, to make Camunda execute only Task2, passing parameters through the execution input and validating the parameters in the execution output?

PS: I am using Spring


Hi @rngouveia,

May we know your use case to execute only Task2?

“Process instance modification can be very useful in JUnit Tests. You can skip the long part to run through the process from the start to the point you want to test and jump directly to the activity or gateway to test”


1 Like

I am playing around with a service embedded Camunda design. I’m using Java Delegate as communication between Camunda and Java code. With this level of integration, it seems to me that Unit Tests should be at the Task level. I know it is possible to start a process at a specified Task with specific input parameters using Process Modification, but that would solve half the problem if I just want to execute one Task. How would I terminate the process and verify the output just after the Task execution?
I have been thinking about using the camunda-bpm-reactor, registering a listener to the end event of the Task, and cancelling it when the said event is thrown. Is that the best approach?

See below post

Thanks man,

Apparently PluggableProcessEngineTestCase doesn’t work with Spring Boot, because it tries to instantiate its own ProcessEngine. But based on the examples I rapidly created an interface:

Now, to Unit Test a Task, I just neet to implement it:

It’s still a work in progress, but I already validated that the idea works