camunda / zeebe-process-test

Testing project for Camunda Platform 8
39 stars 14 forks source link

Make the hasPassed() assertion more informative #369

Open ingorichtsmeier opened 2 years ago

ingorichtsmeier commented 2 years ago

Description

running this assertion:

    assertThat(processInstanceEvent)
      .hasPassedElement("StartEvent_");

throws an assertion error like

java.lang.AssertionError: Expected element with id StartEvent_ to be passed 1 times, but was 0
    at io.camunda.zeebe.process.test.assertions.ProcessInstanceAssert.hasPassedElement(ProcessInstanceAssert.java:226)
    at io.camunda.zeebe.process.test.assertions.ProcessInstanceAssert.hasPassedElement(ProcessInstanceAssert.java:189)
    at com.camunda.consulting.ExampleProcessUnitTest.testHappyPath(ExampleProcessUnitTest.java:35)
...

A message like

Could not find StartEvent_ in the list of passed elements. Instead the process has passed [StartEvent_1, Activity_2]

is more helpful.

camunda-bpm-assert shows this error message: https://github.com/camunda/camunda-bpm-platform/blob/master/test-utils/assert/core/src/main/java/org/camunda/bpm/engine/test/assertions/bpmn/ProcessInstanceAssert.java#L287

saig0 commented 1 month ago

[!Note] Heads up! We are building a new Java testing library for Camunda 8.6. The new library will replace Zeebe Process Test. Read more about upcoming changes here and stay tuned for updates. :rocket: