Testing process with Business Rule Task

What is the common approach to unit testing of processes with dmn’s? Let’s assume following example:

gateway is driven by DMN result variable. Now i want to write a unit test for this case but im facing two issues:

  1. DMN doesnt get deployed with process definitions:

    getProcessEngineRule().getProcessEngine().getRepositoryService().createDecisionDefinitionQuery().list()

    returns 0 results, where querying for processes return all processes in resource folder.

  2. How can i mock the result variable value of DMN without executing DMN in my unit test? (DMN has it’s own test)

Hi @JohnArray,

I don’t know if it is possible to skip the DMN execution with mocking.

So I always simply test the process with the DMN. You can easily deploy both resources to your unit test with

@Deployment(resources = {"myProcess.bpmn", "myDecisionTable.dmn"})

The test of the process needs no change.

Hope that helps, Ingo

1 Like

this indeed helped me to realize my DMN was not included in deployment due to spelling issue in dmn file path lol.

btw. it would be nice to have some sort of DMN skip where we could just pass the result variables with values since testing DMN’s seems to be out of scope of unit testing a process.