We are building our workflows currently using embedded forms within the standard Camunda task UI. This works OK, but it causes a bit of a gap in our unit tests, because the tests have no idea about embedded forms.
When we want to test a user task, we use the TaskService to complete a Task with the variables we expect a user to enter - but there’s no way to be sure these variables are actually the ones created in the embedded form without either manual testing, or a very complex (and low value) browser test against the form.
One thing I was wondering is - could we block forms from creating any new process variables? I.E let the forms update existing variables, but not create new ones? So we’d create all our variables in a start task or script task earlier, and enforce that forms could modify them only.
This would at least narrow the range of possible bugs where someone mis-spells a form field ID, and everything silently works because the form makes a brand new variable that is then ignored by the rest of the workflow.
Or is there some other cunning way people test task forms without loading the entire UI in a set of Selenium tests?
Then you can provide some helper methods in your unit tests to read the form as a file and try simple regexpression to seach for cam-variable-name in the file and compare them to your variable list in the tests.
(Note we are writing our own test bits with some stuff copied from camunda-bpm-assert as we can’t run that library directly due to AssertJ collisions with Spring Boot: https://github.com/camunda/camunda-bpm-assert/issues/90 )