【问题标题】:Camunda with junit5卡蒙达与junit5
【发布时间】:2022-01-24 11:55:57
【问题描述】:

我正在尝试扩展 camunda 和 JUnit5 的测试用例。 我收到以下错误 - 非法调用 execute(job = 'null') - 不能为空! java.lang.IllegalArgumentException: 非法调用 execute(job = 'null') - 不能为空!

@ExtendWith(ProcessEngineExtension.class)
public class SimpleTestCase {

@Deployment(resources = {"testProcess.bpmn"})
@Test
public void shouldExecuteProcess() {

    // Given we create a new process instance
    ProcessInstance processInstance = runtimeService().startProcessInstanceByKey("testProcess");
    // Then it should be active
    assertThat(processInstance).isActive();
    // And it should be the only instance
    assertThat(processInstanceQuery().count()).isEqualTo(1);
    // And there should exist just a single task within that process instance
    assertThat(task(processInstance)).isNotNull();

    ProcessEngineTests.execute(ProcessEngineTests.job());

   BpmnAwareTests.execute(BpmnAwareTests.job());
    // When we complete that task
    complete(task(processInstance));
    // Then the process instance should be ended
    assertThat(processInstance).isEnded();
    //then
    //Checking the run queue
    assertThat(processInstance).hasPassedInOrder(new String[] { "UserTask_1","UserTask_2"});
}

【问题讨论】:

    标签: junit camunda camunda-modeler


    【解决方案1】:
         ProcessInstance processInstance = 
         runtimeService().startProcessInstanceByKey("testProcess");
        // Then it should be active
        assertThat(processInstance).isActive();
        // And it should be the only instance
        assertThat(processInstanceQuery().count()).isEqualTo(1);
        // And there should exist just a single task within that process instance
        assertThat(task(processInstance)).isNotNull();
    
        assertThat(processInstance).isWaitingAt("UserTask_1");
        // When we complete that task
        complete(task(processInstance));
        assertThat(processInstance).isWaitingAt("UserTask_2");
        complete(task(processInstance));
        // Then the process instance should be ended
        assertThat(processInstance).isEnded();
        assertThat(processInstance).hasPassedInOrder("UserTask_1","UserTask_2");
    

    【讨论】:

      猜你喜欢
      • 2021-08-19
      • 1970-01-01
      • 2022-10-24
      • 1970-01-01
      • 2020-06-14
      • 1970-01-01
      • 2023-03-17
      • 2017-03-13
      • 2016-08-23
      相关资源
      最近更新 更多