Hi
I wrote a unitTest for my model.
And everything was fine.
I added a string form for first userTask, and called that form variable in “Element Documentation” section for second userTask.
And now, when i run the unitTest, test failed by this error:
org.camunda.bpm.engine.ProcessEngineException: Unknown property used in expression: some description ${myVariable} Cause: Cannot resolve identifier 'myVariable'
I just want to complete the userTask2.
but when I run the unit test, I face by this error: org.camunda.bpm.engine.ProcessEngineException: Unknown property used in expression: some description ${myVariable} Cause: Cannot resolve identifier 'myVariable'
I used the “myVariable” in Element Description section in userTask2.
Ok, so the variable you’ve defined in the user task will only be created by a user who can operate a front end. This isn’t unusual. In most cases in a Unit Test you’re testing the process not the front end. So you simply need to add the variable when you complete the task.
The camunda bpm asserts documentation is pretty good at explaining this but even better is this talk that @tmetzke gave at camunda con this year which details how to use the API.
Thank you.
You mean, can I define a form variable in userTask1 and use that variable in Element Description for userTask2 and I write unit test like this:
private fun inUser2(processInstance: ProcessInstance): State {
assertThat(processInstance).task("user2")
complete(task(processInstance), withVariables("myVariable", ""))
return State.end