Skip to content

camunda BPM community extension providing support for the AssertJ testing framework

License

Notifications You must be signed in to change notification settings

tlierfeld/camunda-bpm-assert

 
 

Repository files navigation

camunda logo camunda-bpm-assert

This little community-extension to camunda BPM wants to make it easier to write tests for BPMN process definitions executed with the camunda process engine. For that reason, a set of assertions based on Joel Costigliola's AssertJ rich assertions library for java are provided, as well as a few little helpers to make it a bit easier to drive you through your process.

Hopefully this will also make it easier to change your tests half a year after you have written them yourself!-) In short: more readable code - less spaghetti tests!

Spaghetti Test

Table of Contents

## Getting started ### Maven dependency

First, declare the camunda BPM maven repository - if you haven't yet done so. Then you find here the coordinates for including camunda-bpm-assert in Apache Maven Projects:

	<dependency>
	    <groupId>org.camunda.bpm.extension</groupId>
    	<artifactId>camunda-bpm-assert</artifactId>
    	<version>1.0</version>
    	<scope>test</scope>
	</dependency>
### Add a static import to your test class

Create your test case just as described in camunda BPM Testing. Then you just have to add the following static import:

	import static org.camunda.bpm.engine.test.assertions.ProcessEngineTests.*;
### Start using camunda-bpm-assert!

Now you have access to all the assertions provided by the AssertJ library - plus the customised camunda BPM assertions provided by this library. Let's assume you want to assert that your process instance

  • was actually started
  • is waiting at a specific user task and
  • the task is yet unassigned, but waiting to be assigned to a user of a specific group:

Green Bar

Then write:

	assertThat(processInstance).isStarted()
		.task().hasDefinitionKey("edit")
			.hasCandidateGroup("SB-Personal")
			.isNotAssigned();

Green bar?

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.

## Resources ## Maintainer

Martin Schimak - eMail - GitHub - Blog

## License

Apache License, Version 2.0

About

camunda BPM community extension providing support for the AssertJ testing framework

Resources

License

Stars

Watchers

Forks

Packages

No packages published