Unit test failing with classcast exception in upgrade to 7.11

Unit test is failing with the below exception at the end .

java.lang.ClassCastException: org.camunda.bpm.engine.impl.history.handler.DbHistoryEventHandler cannot be cast to org.camunda.bpm.extension.process_test_coverage.listeners.FlowNodeHistoryEventHandler

I am using

But if I moved to below version, it is working fine

Hi @anisk,

Can you further explain your use-case? Are you modifying the default configuration in any case?


no . I am not overriding default configuration my test class is like as below .

Usecase : The camunda process is getting triggered by a listener which is listening kafka topic for an event . Once the process kick start it will process all lined up the service task till it reached Receive message task waiting a message.

@SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.NONE,
        classes = TestApplication.class,
        properties = {

@ActiveProfiles({ "test" })
@Deployment(resources = { "process1.bpmn" })
public class AllocatePathMessageListenerTest {
    private Sink sink;

    private Source source;

    private MessageCollector messageCollector;

    public ProcessEngine processEngine;

    public static ProcessEngineRule rule;

    void initRule() {
        rule = TestCoverageProcessEngineRuleBuilder.create(processEngine).withDetailedCoverageLogging().build();

    public void setup() throws Exception {


Hi @anisk,

your problem is caused by a change in the spring boot starter for Camunda 7.11. which introduced integration with Spring eventing. This is done with a custom history event handler which seems to break the current implementation of the test coverage.

There is a bug report open which you can find here: https://app.camunda.com/jira/browse/CAM-10650

One workaround could be to add the plugin to the configuration postDeploy and override the composite history handler. This would result in removing the Spring eventing integration again, though.

Best, Ben

Hi @benhoffmann - is there any example of this -to add the plugin to the configuration postDeploy and override the composite history handler? I need 7.11 but this process coverage stopping me to use the version .

Hi @anisk,

The implementation of a Process Engine Plugin in Spring Boot could look like this.

public class ProcessTestCoverageProcessEnginePlugin extends AbstractProcessEnginePlugin implements ProcessEnginePlugin {

  public void postInit(ProcessEngineConfigurationImpl processEngineConfiguration) {

Calling ProcessCoverageConfigurator.initializeProcessCoverageExtensions() on postInit() overrides the CompositeEventHandler, finally. This will then, as a consequence, make ProcessTestCoverage run but breaks the functionality of every other History Event Handler that might have been registered in the Composite. As of now, only Spring Eventing Integration is affected.

The ticket @benhoffmann referred to is connected to a feature request that passed its evaluation and will bring a proper History Event Handler interface that will enable us to fix ProcessTestCoverage later on.

Hope that helps,

Best, Sebastian

1 Like

The plugin approach didn’t work for me (even after downgrading to 7.10.0) (added it via @Import on the @SpringBootTest).

An alternate work around is run the tests without coverage e.g
ProcessEngineRule rule = new ProcessEngineRule(processEngine);