Hi,
in my BPMN file I use a “take” listener in a sequence flow implemented as inline Javascript which modifies a proces variable.
I want to test my process model in Java and use the ProcessEngineRule therefore but it seems like the Javascript part is not executed, so I get unexpected results in my test cases.
Is there a way to “unit” test the execution of the Javascript in the listener too?
Thanks
Chris
Thanks a lot - StephenOTT ^^
I will get into that. I am new to Spock but this looks promising.
You can do the same without Spock. There is nothing in the config that is special or unique to Spock.
Hi Stephen
I eventually came to the point again where i need to test Javascript in my process definition.
I looked through your example code on GitHub
As far as I understand, your test loads external JS resources.
I use inline Javascript for my purpose. Only a few lines long. How can I test these?
You can parse the BPMN file using the Bpmn.class (part of Camunda) and then use the model API to navigate to where your script is and exact the script text and pass it into the script engine in the same way the other examples use the text from the external text files.
https://docs.camunda.org/javadoc/camunda-bpm-platform/7.13/org/camunda/bpm/model/bpmn/Bpmn.html
See the readModelFrom…() methods .
Once you have the model you can select the script task by the Id: something like: ModelInstance (Camunda BPM Javadocs 7.13.11-ee)
1 Like