Coder Social home page Coder Social logo

camunda-bpm-assert's Introduction

 Camunda BPM Assert

The community extension 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));


The goal? More readable code - less spaghetti tests!
The increased readability will make it much easier to dig through your test code, the next time you need to change it will ultimately come. And your increased efficiency will make your organisational stakeholders happy, too! 😄

Use it with confidence!

Camunda BPM Assert works with all versions of Camunda BPM since 7.0 up to the most recent and all the Java versions (1.6, 1.7., 1.8) still relevant for Camunda BPM installations out there. This is continuously verified by executing around 350 test cases against a travis ci test matrix. In 2014, the library won the Camunda BPM Community Award.

Get started in 3 simple steps!

1. Add a maven test dependency to your project:

<dependency>
    <groupId>org.camunda.bpm.extension</groupId>
    <artifactId>camunda-bpm-assert</artifactId>
    <version>1.2</version> <!-- Use 2.0-alpha2 for the CMMN assertions preview! -->
    <scope>test</scope>
</dependency>

Note however, that if you use a Camunda BPM Maven Archetype to create your project, Camunda BPM Assert is already included in your project setup.

2. Add a static import to your test class

Create your test case just as described in the Camunda BPM Testing Guide. As recommended at the end of that guide, 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 have now access to all the assertions provided by Joel Costigliola's AssertJ rich assertions library - plus the additional Camunda BPM assertions building upon them. Now assume 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? Then write:

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

Green bar?

Congrats! You are successfully using Camunda BPM Assert. Find a more detailed description of the assertions and helper methods available in the Camunda BPM Assert User Guide.

Further Resources

Maintenance & License

Martin Schimak
BlogGitHubeMail
Apache License, Version 2.0

Contributors

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

... and many others. You want to contribute? You are very welcome! Please contact me directly via eMail.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.