Junit test tries to automatically complete external tasks


#1

I’m unit testing my model that consists mostly of external tasks.

In some circumstances, junit (ProcessEngineRule) tries to complete my external tasks at the end of the test but it fails because I have output variables requirements for such action.

Here is a stactrace from such scenario:

Exception
org.camunda.bpm.engine.ScriptEvaluationException: Unable to evaluate script while executing activity 'Task_0zcy7ea' in the process definition with id 'Apply_Task:1:4': groovy.lang.MissingPropertyException: No such property: taskExecuted for class: Script8
	at org.camunda.bpm.engine.impl.scripting.CompiledExecutableScript.evaluate(CompiledExecutableScript.java:57)
	at org.camunda.bpm.engine.impl.scripting.SourceExecutableScript.evaluate(SourceExecutableScript.java:57)
	at org.camunda.bpm.engine.impl.scripting.ExecutableScript.execute(ExecutableScript.java:59)
	at org.camunda.bpm.engine.impl.scripting.env.ScriptingEnvironment.execute(ScriptingEnvironment.java:97)
	at org.camunda.bpm.engine.impl.scripting.env.ScriptingEnvironment.execute(ScriptingEnvironment.java:83)
	at org.camunda.bpm.engine.impl.delegate.ScriptInvocation.invoke(ScriptInvocation.java:40)
	at org.camunda.bpm.engine.impl.delegate.DelegateInvocation.proceed(DelegateInvocation.java:54)
	at org.camunda.bpm.engine.impl.delegate.DefaultDelegateInterceptor.handleInvocationInContext(DefaultDelegateInterceptor.java:87)
	at org.camunda.bpm.engine.impl.delegate.DefaultDelegateInterceptor.handleInvocation(DefaultDelegateInterceptor.java:59)
	at org.camunda.bpm.engine.impl.scripting.ScriptValueProvider.getValue(ScriptValueProvider.java:39)
	at org.camunda.bpm.engine.impl.core.variable.mapping.OutputParameter.execute(OutputParameter.java:43)
	at org.camunda.bpm.engine.impl.core.variable.mapping.IoParameter.execute(IoParameter.java:47)
	at org.camunda.bpm.engine.impl.core.variable.mapping.IoMapping.executeOutputParameters(IoMapping.java:41)
	at org.camunda.bpm.engine.impl.persistence.entity.ExecutionEntity.destroy(ExecutionEntity.java:511)
	at org.camunda.bpm.engine.impl.pvm.runtime.operation.PvmAtomicOperationDeleteCascadeFireActivityEnd.eventNotificationsCompleted(PvmAtomicOperationDeleteCascadeFireActivityEnd.java:71)
	at org.camunda.bpm.engine.impl.pvm.runtime.operation.PvmAtomicOperationDeleteCascadeFireActivityEnd.eventNotificationsCompleted(PvmAtomicOperationDeleteCascadeFireActivityEnd.java:28)
	at org.camunda.bpm.engine.impl.core.operation.AbstractEventAtomicOperation.execute(AbstractEventAtomicOperation.java:65)
	at org.camunda.bpm.engine.impl.interceptor.AtomicOperationInvocation.execute(AtomicOperationInvocation.java:91)
	at org.camunda.bpm.engine.impl.interceptor.CommandInvocationContext.invokeNext(CommandInvocationContext.java:125)
	at org.camunda.bpm.engine.impl.interceptor.CommandInvocationContext.performNext(CommandInvocationContext.java:104)
	at org.camunda.bpm.engine.impl.interceptor.CommandInvocationContext.performOperation(CommandInvocationContext.java:79)
	at org.camunda.bpm.engine.impl.interceptor.CommandInvocationContext.performOperation(CommandInvocationContext.java:69)
	at org.camunda.bpm.engine.impl.persistence.entity.ExecutionEntity.performOperationSync(ExecutionEntity.java:629)
	at org.camunda.bpm.engine.impl.persistence.entity.ExecutionEntity.performOperationSync(ExecutionEntity.java:604)
	at org.camunda.bpm.engine.impl.core.operation.AbstractEventAtomicOperation.execute(AbstractEventAtomicOperation.java:58)
	at org.camunda.bpm.engine.impl.interceptor.AtomicOperationInvocation.execute(AtomicOperationInvocation.java:91)
	at org.camunda.bpm.engine.impl.interceptor.CommandInvocationContext.invokeNext(CommandInvocationContext.java:125)
	at org.camunda.bpm.engine.impl.interceptor.CommandInvocationContext.performNext(CommandInvocationContext.java:104)
	at org.camunda.bpm.engine.impl.interceptor.CommandInvocationContext.performOperation(CommandInvocationContext.java:79)
	at org.camunda.bpm.engine.impl.interceptor.CommandInvocationContext.performOperation(CommandInvocationContext.java:69)
	at org.camunda.bpm.engine.impl.persistence.entity.ExecutionEntity.performOperationSync(ExecutionEntity.java:629)
	at org.camunda.bpm.engine.impl.persistence.entity.ExecutionEntity.performOperationSync(ExecutionEntity.java:604)
	at org.camunda.bpm.engine.impl.core.operation.AbstractEventAtomicOperation.execute(AbstractEventAtomicOperation.java:58)
	at org.camunda.bpm.engine.impl.interceptor.AtomicOperationInvocation.execute(AtomicOperationInvocation.java:91)
	at org.camunda.bpm.engine.impl.interceptor.CommandInvocationContext.invokeNext(CommandInvocationContext.java:125)
	at org.camunda.bpm.engine.impl.interceptor.CommandInvocationContext.performNext(CommandInvocationContext.java:104)
	at org.camunda.bpm.engine.impl.interceptor.CommandInvocationContext.performOperation(CommandInvocationContext.java:79)
	at org.camunda.bpm.engine.impl.persistence.entity.ExecutionEntity.performOperation(ExecutionEntity.java:618)
	at org.camunda.bpm.engine.impl.persistence.entity.ExecutionEntity.performOperation(ExecutionEntity.java:594)
	at org.camunda.bpm.engine.impl.pvm.runtime.operation.PvmAtomicOperationDeleteCascade.execute(PvmAtomicOperationDeleteCascade.java:53)
	at org.camunda.bpm.engine.impl.pvm.runtime.operation.PvmAtomicOperationDeleteCascade.execute(PvmAtomicOperationDeleteCascade.java:22)
	at org.camunda.bpm.engine.impl.interceptor.AtomicOperationInvocation.execute(AtomicOperationInvocation.java:91)
	at org.camunda.bpm.engine.impl.interceptor.CommandInvocationContext.invokeNext(CommandInvocationContext.java:125)
	at org.camunda.bpm.engine.impl.interceptor.CommandInvocationContext.performNext(CommandInvocationContext.java:104)
	at org.camunda.bpm.engine.impl.interceptor.CommandInvocationContext.performOperation(CommandInvocationContext.java:79)
	at org.camunda.bpm.engine.impl.persistence.entity.ExecutionEntity.performOperation(ExecutionEntity.java:618)
	at org.camunda.bpm.engine.impl.persistence.entity.ExecutionEntity.performOperation(ExecutionEntity.java:594)
	at org.camunda.bpm.engine.impl.pvm.runtime.PvmExecutionImpl.deleteCascade(PvmExecutionImpl.java:560)
	at org.camunda.bpm.engine.impl.persistence.entity.ExecutionManager.deleteProcessInstance(ExecutionManager.java:87)
	at org.camunda.bpm.engine.impl.persistence.entity.ExecutionManager.deleteProcessInstancesByProcessDefinition(ExecutionManager.java:60)
	at org.camunda.bpm.engine.impl.persistence.entity.DeploymentManager.deleteDeployment(DeploymentManager.java:89)
	at org.camunda.bpm.engine.impl.cmd.DeleteDeploymentCmd.execute(DeleteDeploymentCmd.java:70)
	at org.camunda.bpm.engine.impl.cmd.DeleteDeploymentCmd.execute(DeleteDeploymentCmd.java:40)
	at org.camunda.bpm.engine.impl.interceptor.CommandExecutorImpl.execute(CommandExecutorImpl.java:24)
	at org.camunda.bpm.engine.impl.interceptor.CommandContextInterceptor.execute(CommandContextInterceptor.java:104)
	at org.camunda.bpm.engine.impl.interceptor.ProcessApplicationContextInterceptor.execute(ProcessApplicationContextInterceptor.java:66)
	at org.camunda.bpm.engine.impl.interceptor.LogInterceptor.execute(LogInterceptor.java:30)
	at org.camunda.bpm.engine.impl.RepositoryServiceImpl.deleteDeployment(RepositoryServiceImpl.java:111)
	at org.camunda.bpm.engine.impl.test.TestHelper.deleteDeployment(TestHelper.java:153)
	at org.camunda.bpm.engine.impl.test.TestHelper.annotationDeploymentTearDown(TestHelper.java:148)
	at org.camunda.bpm.engine.test.ProcessEngineRule.finished(ProcessEngineRule.java:219)
	at org.junit.rules.TestWatcher.finishedQuietly(TestWatcher.java:117)
	at org.junit.rules.TestWatcher.access$400(TestWatcher.java:46)
	at org.junit.rules.TestWatcher$1.evaluate(TestWatcher.java:64)
	at org.camunda.bpm.engine.test.ProcessEngineRule$1.evaluate(ProcessEngineRule.java:165)
	at org.junit.rules.RunRules.evaluate(RunRules.java:20)
	at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:325)
	at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:78)
	at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:57)
	at org.junit.runners.ParentRunner$3.run(ParentRunner.java:290)
	at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71)
	at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288)
	at org.junit.runners.ParentRunner.access$000(ParentRunner.java:58)
	at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:268)
	at org.junit.runners.ParentRunner.run(ParentRunner.java:363)
	at org.junit.runner.JUnitCore.run(JUnitCore.java:137)
	at com.intellij.junit4.JUnit4IdeaTestRunner.startRunnerWithArgs(JUnit4IdeaTestRunner.java:68)
	at com.intellij.rt.execution.junit.IdeaTestRunner$Repeater.startRunnerWithArgs(IdeaTestRunner.java:47)
	at com.intellij.rt.execution.junit.JUnitStarter.prepareStreamsAndStart(JUnitStarter.java:242)
	at com.intellij.rt.execution.junit.JUnitStarter.main(JUnitStarter.java:70)
Caused by: javax.script.ScriptException: groovy.lang.MissingPropertyException: No such property: taskExecuted for class: Script8
	at org.codehaus.groovy.jsr223.GroovyScriptEngineImpl.eval(GroovyScriptEngineImpl.java:355)
	at org.codehaus.groovy.jsr223.GroovyCompiledScript.eval(GroovyCompiledScript.java:72)
	at javax.script.CompiledScript.eval(CompiledScript.java:92)
	at org.camunda.bpm.engine.impl.scripting.CompiledExecutableScript.evaluate(CompiledExecutableScript.java:51)
	... 79 more
Caused by: groovy.lang.MissingPropertyException: No such property: taskExecuted for class: Script8
	at org.codehaus.groovy.runtime.ScriptBytecodeAdapter.unwrap(ScriptBytecodeAdapter.java:53)
	at org.codehaus.groovy.runtime.callsite.PogoGetPropertySite.getProperty(PogoGetPropertySite.java:52)
	at org.codehaus.groovy.runtime.callsite.AbstractCallSite.callGroovyObjectGetProperty(AbstractCallSite.java:307)
	at Script8.run(Script8.groovy:1)
	at org.codehaus.groovy.jsr223.GroovyScriptEngineImpl.eval(GroovyScriptEngineImpl.java:352)
	... 82 more

Is it possible to disable this behaviour? It gives very confusing errors to the user.


#2

I also have the same problem when using Process Instance Modification API. Cancelled activity executes its output variables mapping.


#3

Could you please share the code of your test?