Junit Failling

Hello Team ,

  1. assertThat(pVariablesInReturn).isStarted();

  2. assertThat(pVariablesInReturn)
    test case is failing in 2 point
    getting this exception
    java.lang.AssertionError: Expecting org.camunda.bpm.engine.impl.persistence.entity.ProcessInstanceWithVariablesImpl@7e06727f to have passed activities [end_event] at least once, but actually we found that it passed [StartEvent_1]. (Please make sure you have set the history service of the engine to at least ‘activity’ or a higher level before making use of this assertion!)
    any suggestion ?

Hello @Krishan_Pratap_Singh ,

I am missing some context here. Could you provide us with the BPMN File containing the process you want to test here?


@Krishan_Pratap_Singh Refer this page: Testing | docs.camunda.org and Testing Entire Process Paths - Camunda

You should set history level for testing processes in src/test/resources/camunda.cfg.xml like below:

<?xml version="1.0" encoding="UTF-8"?>

<beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd">
  <bean id="processEngineConfiguration" class="org.camunda.bpm.engine.impl.cfg.StandaloneInMemProcessEngineConfiguration"> 
    <property name="history" value="full" />
    <property name="expressionManager">
      <bean class="org.camunda.bpm.engine.test.mock.MockExpressionManager"/>
    <property name="processEnginePlugins">

Otherwise you can set the history level at test method using annotation:

public class MyBusinessProcessTest {

  public ProcessEngineRule processEngineRule = new ProcessEngineRule();

  public void ruleUsageExample() {
    RuntimeService runtimeService = processEngineRule.getRuntimeService();

    HistoryService historyService = processEngineRule.getHistoryService();
    // requires history level >= "activity"
    HistoricVariableInstance variable = historyService
    assertEquals("value", variable.getValue());
1 Like

Hi @Krishan_Pratap_Singh,

in this case the message

is misleading in most cases. Your process is likely to wait somewhere in between, before the end event.

A good way to visualize this is enableing the process test coverage: GitHub - camunda-community-hub/camunda-process-test-coverage: Community Extension Helper library to visualize which parts of a BPMN process have been covered by a process test..

With this tool you can see which tasks are already covered by your test and where your process instance is stuck.

My guess is that you checked some service task with Async Before and you have to execute the job explicitly to contine the process instance.

Hope this helps, Ingo

1 Like

@Ingo_Richtsmeier @aravindhrs @jonathan.lukas correct I am using camunda:asyncBefore=“true”

RuntimeService runtimeService = processEngine.getRuntimeService();
ProcessInstanceWithVariables pVariablesInReturn
= runtimeService.createProcessInstanceByKey(“Prcess name”)
.setVariable(“'Some vale”)

before that it is working after using asyn=true after that getting error

@Ingo_Richtsmeier orrect I am using camunda:asyncBefore=“true” ,
before that it is working after using asyn=true after that getting error
plz help me where i have to change in unit test

Hi @Krishan_Pratap_Singh,



between the start and the end of the process instance in your test.

You can read more about the details here: Transactions in Processes | docs.camunda.org

The shortcut in camunda-bpm-assert is documented in the github repository: camunda-bpm-assert/User_Guide_BPMN.md at master · camunda/camunda-bpm-assert · GitHub.

Hope this helps, Ingo


yes…it’s work for me

1 Like