Hi,
we have decided to write integration test cases for BPM process.
Please suggest which will be better approach for camunda process,
Thanks,
Sri
Hi,
we have decided to write integration test cases for BPM process.
Please suggest which will be better approach for camunda process,
Thanks,
Sri
Hi @sridhar_akella,
See this section of the documentation: https://docs.camunda.org/manual/latest/user-guide/testing/
For a more specific answer, please ask a more specific question.
Cheers,
Thorben
In context to integration testing - Iāve found that running Camundaās engine from within a test-case (i.e. userās desktop) doesnāt fully reflect the serverās features/functions from an integration perspective. Meaning that you need to drive the process as itās installed on the target platform:
Basically, you need to verify the server as itās running in the hostās ecosystem as apposed to within JUnit⦠Goal is to test Camunda on the target environment - not the developerās desktop. Assuming the build-admin and/or QA specialist will not have Camunda installed locally (i.e. CI cycles).
With this requirement in mind, Iāve been testing via Camunda ReST interface. A test case, in this context, though being initiated within JUnit, is invoking process+integration against an installed BPM engine. This way, the test-case drives the process as itās intended to run on the host. And, this is critical from an integration perspective - tests include various SOA (and other) interfaces which may not be available outside the host.
Iāve recently been looking at Apache-Camelās JUnit extension (the test-part of Camel) as this includes the ability for asynchronous testing: whereby we can both emit and receive events concurrently (as in simulating SOA interfaces). And, this feature allows for loading sets of events into the server to both observe the process itself in a more realistic setting (i.e. server/network saturation).
@garysamuelson do you see all of your testing on the target platform being done through Rest APIs and something like PhantomJS (for simulating user tasks) ?
@StephenOTT Iām not sure that anything beyond the ReST API is necessary for moving a token between tasks. Unless, however⦠youāre testing specific UI features such as JS libraries contained within the context of the browserās JS environment (executing JS libraries - i.e. Chromeās container).
Iām strict about only using java for Camunda task implementations - avoiding embedded script within the process model itself (the bpmn xml diagrams). I may have bits of script in the model - but only enough to evaluate expressions evaluating CDI java-beans.
And, if Camundaās ReST API doesnāt cover your requirements, itās relatively straightforward to simply write your own ReST API to fill in the gaps.
For example - if Camundaās ReST doesnāt meet my needs, I typically add a JAX-RS implementation as follows:
NOTE: this is an arbitrary example because Camunda already has a ReST operation for sending a message. Problem though is that Camundaās ReST āstart-messageā call has a data-cap of roughly 5k characters.
@Inject
private RepositoryService repositoryService;
@Inject
private RuntimeService runtimeService;
@Inject
private HistoryService historyService;
And then drive the necessary Camunda features directly via Java. Example of sending a message:
runtimeService.createMessageCorrelation(āstart_messageā)
.setVariable(ābpmApiMessageā, āmyBpmApi_message_payloadā)
.correlate();
We have been avoiding java, but using external scripts.
@StephenOTT Script-only? Understandably.
I see it as two camps⦠Generally. Scripts or Java. Iāve worked both sides of the ānetā.
I used to author everything in Script - but, this was on a different platform. I migrated back to Java since JDK 1.7 - 1.8. Really exited about Java 1.8. Though a little concerned why Oracle is dragging their feet on JavaEE - if that makes a difference given openJDK. I was also somewhat of a JS-master with dojo (UI/Library framework). Since dojo fell out-of-favor Iāve moved on. Itās all getting so complicated - like medical specialists weāve become.
But the question⦠is Java more like brain-surgery (wizard behind the green curtain) and JS-script the chiropractitioner (where the system meets the user)?
We try to use JavaScript and fallback of Groovy as much as possible. Few spots where we use Java directly. But little as possible.
We do this because Camunda is just a embedded workflow tool for us. It is part of a bigger āplatformā / use case where the users/configuration staff are using JavaScript. So trying to standardize as much as possible.
I usually find the learning curve for Java is high and the docs are difficult to read and understand for non-java devs.
Obviously if a complex task calls for Java, and we use it. But most of the āloadā is handed off through web services/service tasks/external tasks to another system, and camunda really just handles the āorchestrationā