UnitTest fails if TestCoverage is enabled for callActivity task

Hi Team,

I have two bpmn models defined my main process is calling the sub process. using the callActivty service task.
If i enable the TestCoverage the unit test fails with the following error message.
18:27:01.675 [main] ERROR org.camunda.bpm.engine.context - ENGINE-16006 BPMN Stack Trace:
StartEvent_1 (activity-start, ProcessInstance[8])
StartEvent_1

18:27:01.681 [main] ERROR org.camunda.bpm.engine.context - ENGINE-16004 Exception while closing command context: null
java.lang.NullPointerException: null
at org.camunda.bpm.extension.process_test_coverage.model.ClassCoverage.addCoveredElement(ClassCoverage.java:35) ~[camunda-bpm-process-test-coverage-0.3.1.jar:0.3.1]
at org.camunda.bpm.extension.process_test_coverage.junit.rules.CoverageTestRunState.addCoveredElement(CoverageTestRunState.java:56) ~[camunda-bpm-process-test-coverage-0.3.1.jar:0.3.1]
at org.camunda.bpm.extension.process_test_coverage.listeners.FlowNodeHistoryEventHandler.handleEvent(FlowNodeHistoryEventHandler.java:52) ~[camunda-bpm-process-test-coverage-0.3.1.jar:0.3.1]
at org.camunda.bpm.engine.impl.history.parser.HistoryExecutionListener.notify(HistoryExecutionListener.java:55) ~[camunda-engine-7.7.0.jar:7.7.0]

It works as exected if i replace the lines as below.
//public static ProcessEngineRule rule = TestCoverageProcessEngineRuleBuilder.create().build();
public static ProcessEngineRule rule = new ProcessEngineRule();

Can any one please help me how to enable test coverage in case i have two bpmn models calling each other.

Thanks,
Sai Arun J

1 Like

Hi,

You could report this on the plugin’s issue tracker at https://github.com/camunda/camunda-bpm-process-test-coverage/issues. Please try to attach minimal process models that reproduce the issue along with that.

Cheers,
Thorben

Hi Thorben,

Upgrading the camunda-bpm-process-test-coverage to .3.2 version fixed my problem
Thank you so much for the response.

Thanks,
Sai Arun J

1 Like

This issue still exists in camunda-bpm-process-test-coverage .3.2 update but under different conditions:


mocking subprocess from embedded subprocess will result in NPE:
java.lang.NullPointerException
at org.camunda.bpm.extension.process_test_coverage.model.MethodCoverage.addCoveredElement(MethodCoverage.java:63)
at org.camunda.bpm.extension.process_test_coverage.model.ClassCoverage.addCoveredElement(ClassCoverage.java:35)
at org.camunda.bpm.extension.process_test_coverage.junit.rules.CoverageTestRunState.addCoveredElement(CoverageTestRunState.java:56)
at org.camunda.bpm.extension.process_test_coverage.listeners.FlowNodeHistoryEventHandler.handleEvent(FlowNodeHistoryEventHandler.java:52)
at org.camunda.bpm.engine.impl.history.parser.HistoryExecutionListener.notify(HistoryExecutionListener.java:59)
at org.camunda.bpm.engine.impl.history.parser.HistoryExecutionListener.notify(HistoryExecutionListener.java:38)
at org.camunda.bpm.engine.impl.core.instance.CoreExecution.invokeListener(CoreExecution.java:101)
at org.camunda.bpm.engine.impl.core.operation.AbstractEventAtomicOperation.execute(AbstractEventAtomicOperation.java:55)
at org.camunda.bpm.engine.impl.interceptor.AtomicOperationInvocation.execute(AtomicOperationInvocation.java:96)
at org.camunda.bpm.engine.impl.interceptor.CommandInvocationContext.invokeNext(CommandInvocationContext.java:128)
at org.camunda.bpm.engine.impl.interceptor.CommandInvocationContext.performNext(CommandInvocationContext.java:108)
at org.camunda.bpm.engine.impl.interceptor.CommandInvocationContext.performOperation(CommandInvocationContext.java:83)
at org.camunda.bpm.engine.impl.persistence.entity.ExecutionEntity.performOperation(ExecutionEntity.java:640)
at org.camunda.bpm.engine.impl.persistence.entity.ExecutionEntity.performOperation(ExecutionEntity.java:614)
at org.camunda.bpm.engine.impl.pvm.runtime.operation.PvmAtomicOperationActivityStartCreateScope.scopeCreated(PvmAtomicOperationActivityStartCreateScope.java:43)
at org.camunda.bpm.engine.impl.pvm.runtime.operation.PvmAtomicOperationCreateScope.execute(PvmAtomicOperationCreateScope.java:54)
at org.camunda.bpm.engine.impl.pvm.runtime.operation.PvmAtomicOperationCreateScope.execute(PvmAtomicOperationCreateScope.java:28)
at org.camunda.bpm.engine.impl.interceptor.AtomicOperationInvocation.execute(AtomicOperationInvocation.java:96)
at org.camunda.bpm.engine.impl.interceptor.CommandInvocationContext.invokeNext(CommandInvocationContext.java:128)
at org.camunda.bpm.engine.impl.interceptor.CommandInvocationContext.performNext(CommandInvocationContext.java:115)
at org.camunda.bpm.engine.impl.interceptor.CommandInvocationContext.performOperation(CommandInvocationContext.java:83)
at org.camunda.bpm.engine.impl.persistence.entity.ExecutionEntity.performOperation(ExecutionEntity.java:640)
at org.camunda.bpm.engine.impl.persistence.entity.ExecutionEntity.performOperation(ExecutionEntity.java:614)
at org.camunda.bpm.engine.impl.pvm.runtime.PvmExecutionImpl.start(PvmExecutionImpl.java:248)
at org.camunda.bpm.engine.impl.persistence.entity.ExecutionEntity.start(ExecutionEntity.java:449)
at org.camunda.bpm.engine.impl.cmd.StartProcessInstanceCmd.execute(StartProcessInstanceCmd.java:66)
at org.camunda.bpm.engine.impl.cmd.StartProcessInstanceCmd.execute(StartProcessInstanceCmd.java:38)
at org.camunda.bpm.engine.impl.interceptor.CommandExecutorImpl.execute(CommandExecutorImpl.java:28)
at org.camunda.bpm.engine.impl.interceptor.CommandContextInterceptor.execute(CommandContextInterceptor.java:107)
at org.camunda.bpm.engine.impl.interceptor.ProcessApplicationContextInterceptor.execute(ProcessApplicationContextInterceptor.java:70)
at org.camunda.bpm.engine.impl.interceptor.LogInterceptor.execute(LogInterceptor.java:33)
at org.camunda.bpm.engine.impl.ProcessInstantiationBuilderImpl.executeWithVariablesInReturn(ProcessInstantiationBuilderImpl.java:166)
at org.camunda.bpm.engine.impl.ProcessInstantiationBuilderImpl.execute(ProcessInstantiationBuilderImpl.java:132)
at org.camunda.bpm.engine.impl.ProcessInstantiationBuilderImpl.execute(ProcessInstantiationBuilderImpl.java:128)
at org.camunda.bpm.engine.impl.RuntimeServiceImpl.startProcessInstanceByKey(RuntimeServiceImpl.java:107)
at org.camunda.bpm.scenario.impl.ProcessRunnerImpl$1.start(ProcessRunnerImpl.java:146)
at org.camunda.bpm.scenario.impl.ProcessRunnerImpl.run(ProcessRunnerImpl.java:174)
at org.camunda.bpm.scenario.impl.ProcessRunnerImpl.next(ProcessRunnerImpl.java:185)
at org.camunda.bpm.scenario.impl.ScenarioImpl.execute(ScenarioImpl.java:38)
at org.camunda.bpm.scenario.impl.ProcessRunnerImpl.execute(ProcessRunnerImpl.java:119)

Issued a ticket:

Hi, John!
I had the same problem. As a work around you can exclude the processDefinitionKey which you use in CallActivityMock from the process coverage engine like follow:
rule = TestCoverageProcessEngineRuleBuilder.create(processEngine) .excludeProcessDefinitionKeys("MOCKED_PROCESS_KEY").build();
It helped me.