Skip to content

Latest commit

 

History

History

gradle-plugin

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 
 
 

Gradle Plugin

The plugin org.camunda.community.bpmndt registers the Gradle task generateTestCases. It generates the test code under build/bpmndt and adds this directory as test source directory, which is automatically compiled before the compileTestJava task of Gradle's Java plugin. The compilation results (test cases and API classes) will be available in the test classpath afterwards.

⚠️ Within Eclipse, the Gradle task generateTestCases must be executed manually to generate the test cases:

  1. Create a new Gradle task configuration via Run > Run Configurations... > Gradle Task > New Configuration
  2. Choose the working directory via Workspace...
  3. Add the generateTestCases task
  4. Run the Gradle task configuration

⚠️ Within IntelliJ IDEA, the Gradle task generateTestCases must be executed manually to generate the test cases - see Run Gradle tasks:

  1. Type
<CTRL><CTRL>
gradle generateTestCases
  1. Right click the build/bpmndt test sources folder and perform a Reload from Disk

Usage

In settings.gradle, define the plugin and a resolution strategy, since the plugin is provided as a Maven artfiact via Maven Central:

pluginManagement {
  plugins {
    id 'org.camunda.community.bpmndt'
  }

  resolutionStrategy {
    eachPlugin {
      if (requested.id.toString() == 'org.camunda.community.bpmndt') {
        useModule("org.camunda.community:bpmn-driven-testing-gradle-plugin:0.11.0")
      }
    }
  }

  repositories {
    mavenCentral()
  }
}

In build.gradle, add the plugin beside the java Gradle plugin:

plugins {
  id 'java'
  id 'org.camunda.community.bpmndt'
}

Please see Maven Central to get a specific version.

Configuration

Available properties:

Parameter Type Description Default value
packageName String Package name, used for the generated test sources generated
processEnginePlugins List List of process engine plugins to register at the process engine (not required for Spring Boot, since process engine plugins must be exposed as beans) -
springEnabled Boolean Enables Spring based testing (not required for Spring Boot, since here only the BpmndtProcessEnginePlugin must be exposed as a bean) false

The plugin's configuration is done in build.gradle within the bpmndt extension element:

bpmndt {
  packageName = 'generated'
  processEnginePlugins = []
  springEnabled = false
}

Dependencies

Add dependencies, which are required to execute the generated test code:

dependencies {
  implementation 'org.camunda.bpm:camunda-engine:7.21.0'

  testImplementation 'com.h2database:h2:2.2.224'
  testImplementation 'org.assertj:assertj-core:3.24.2'
  testImplementation 'org.camunda.bpm.assert:camunda-bpm-assert:15.0.0'
  testImplementation 'org.junit.jupiter:junit-jupiter-api:5.10.1'

  testRuntimeOnly 'org.junit.jupiter:junit-jupiter-engine:5.10.1'
}

test {
  useJUnitPlatform()
}

For Spring based testing, additional dependencies are required:

dependencies {
  implementation 'org.camunda.bpm:camunda-engine-spring:7.21.0'
  implementation 'org.springframework:spring-beans:6.1.5'
  implementation 'org.springframework:spring-context:6.1.5'
  implementation 'org.springframework:spring-jdbc:6.1.5'

  testImplementation 'org.springframework:spring-test:6.1.5'
}

For Spring Boot based testing, additional dependencies are required:

dependencies {
  implementation 'org.camunda.bpm.springboot:camunda-bpm-spring-boot-starter:7.21.0'

  testImplementation 'org.springframework.boot:spring-boot-starter-test:3.2.4'
}

Recommended versions:

Dependency Version
Camunda BPM 7.21.0
Camunda BPM Assert 15.0.0
JUnit 5 (Jupiter) 5.10.1
Assertj 3.24.2
Spring Framework 6.1.5
Spring Boot 3.2.4

Development

⚠️ This and the subsequent sections are only important for Gradle plugin development!

Since the latest Gradle dependencies are not available via Maven Central or other remote repositories, this module uses a local Maven repository that contains the required dependencies. For the development within an IDE, it is recommended to add the lib/ directory of a local Gradle installation manually to the classpath.

The development is done with Gradle in version 8.5.

Testing

Beside unit tests, a set of integration tests exist, which verify that the Gradle plugin works correctly when executed within a Gradle build. The integration tests are implemented using the Robot Framework (Java implementation).

To execute unit and integration tests, run:

mvn clean integration-test -pl gradle-plugin -am

The Robot test report is written to target/robot/report.html.