JUnit 5 extension

The BonitaTests extension is the entry point to create Bonita integration tests. It allows to specify some behaviors, and to inject the BonitaTestToolkit into the test methods.

Integrations tests are built upon the Bonita Test Toolkit, based on the open-source Bonita Java Client.
The Bonita Test Toolkit is only available for Enterprise, Performance, Efficiency, and Teamwork editions.

Create the Bonita test extension

The Bonita test extension is a JUnit 5 extension, it can be registered using the annotation @BonitaTests.

The extension can be registered through the annotation BonitaTests or manually.

Register the extension using the annotation BonitaTests

This annotation has to be added on the test class.

class ProcessIT {

Register the extension manually

The extension can be registered manually, using the JUnit 5 annotation RegisterExtension.

class ProcessIT {

    static BonitaTestExtension bonitaExtension = new BonitaTestExtension();


Inject BonitaTestToolkit

Once the extension registered, you can inject a BonitaTestToolkit instance as a test method parameter.

@BonitaTests(disableReport = false) (1)
class ProcessIT {

    static void beforeAllTests(BonitaTestToolkit toolkit){

    void beforeEachTests(BonitaTestToolkit toolkit){

    void testMyProcess(BonitaTestToolkit toolkit){
        var myProcess = toolkit.getProcessDefinition("MyProcess");

1 false is the default value, if you want to disable the generated HTML reports, set it to true.

Configure a logger

The Bonita test toolkit rely on SLF4J 2.x logger API. You may plug the SLF4J implementation of your choice in your project.

Logback example

Add the logback-classic dependency in your pom.xml
Add a logback.xml file in the src/test/resources folder

  <appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
    <!-- encoders are assigned the type
         ch.qos.logback.classic.encoder.PatternLayoutEncoder by default -->
      <pattern>%d{HH:mm:ss.SSS} [%thread] %highlight([%level]) %logger{36} - %msg%n</pattern>

  <root level="warn">
    <appender-ref ref="STDOUT" />

  <logger name="org.bonitasoft.web.client" level="warn" />
  <logger name="com.bonitasoft.test.toolkit" level="info" /> (1)

  <!-- Replace with the package containing your tests-->
  <logger name="com.company.project.test" level="info" />

1 You may use the DEBUG level to enhance the console output with contract content when instantiating a process or executing a task.