Skip to content

Easily test/drive Camunda BPM processes and cases and assert their status.

License

Notifications You must be signed in to change notification settings

rezza72/camunda-bpm-assert

 
 

Repository files navigation

 Camunda BPM Assert

Camunda BPM Assert makes it easy to assert the status of your BPMN processes and CMMN cases when driving them forward in your typical unit test methods. Simply write code like

assertThat(instance).isWaitingAt("UserTask_InformCustomer");
assertThat(task).hasCandidateGroup("Sales").isNotAssigned();

Furthermore a set of static helper methods is provided to make it easier to drive through a process. Based on the 80/20 principle the library reaches out to make those things simple you need really often. You will e.g. often have a a single open task instance in your process instance. Then just write

complete(task(instance), withVariables("approved", true));

Compatibility

Camunda BPM Assert works with the versions of Camunda BPM as shown in the documentation and multiple Java versions (1.7, 1.8+). This is continuously verified by executing around 500 test cases against a travis ci test matrix.

Get started in 3 simple steps!

1. Add a maven test dependency to your project:

<dependency>
    <groupId>org.camunda.bpm.assert</groupId>
    <artifactId>camunda-bpm-assert</artifactId>
    <version>3.0.0-alpha1</version>
    <scope>test</scope>
</dependency>

Additionally, Joel Costigliola's AssertJ needs to be provided as a dependency with a version that is compatible with the one documented in the compatibility matrix.

Please note that if you use Spring Boot or the Camunda Spring Boot Starter in your project, AssertJ is already included in your project's setup. Please choose a compatible Camunda BPM Assert artifact in this case as explained in the documentation.

2. Add a static import to your test class

Create your test case just as described in the Camunda BPM Testing Guide and add Camunda BPM Assert by statically importing it in your test class:

import static org.camunda.bpm.engine.test.assertions.ProcessEngineTests.*;

3. Start using the assertions in your test methods

You now have access to all the Camunda BPM assertions. Assuming you want to assert that your process instance is actually started, waiting at a specific user task and that task should yet be unassigned, but waiting to be assigned to a user of a specific group, just write:

assertThat(processInstance).isStarted()
  .task().hasDefinitionKey("edit")
    .hasCandidateGroup("human-resources")
    .isNotAssigned();

In case you want to combine Camunda BPM Assert with the assertions provided by AssertJ, your imports should like this:

import static org.assertj.core.api.Assertions.*;
import static org.camunda.bpm.engine.test.assertions.ProcessEngineTests.*;

Find a more detailed description of the assertions and helper methods available in the Camunda BPM Assert User Guide.

Further Resources

License

The source files in this repository are made available under the Apache License, Version 2.0.

Credits

The Camunda BPM Assert project used to be the community extension, created and supported by

Martin Schimak (plexiti GmbH)
Jan Galinski (Holisticon AG)
Martin Günther (Holisticon AG)
Malte Sörensen (Holisticon AG)
Simon Zambrovski (Holisticon AG)

... and many others.

In 2014, the library won the Camunda BPM Community Award.

Starting from version 3.0.0 it was adopted as part of the Camunda BPM Platform.

About

Easily test/drive Camunda BPM processes and cases and assert their status.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Java 100.0%