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.
generateTestCases
must be executed manually to generate the test cases:
- Create a new Gradle task configuration via
Run
>Run Configurations...
>Gradle Task
>New Configuration
- Choose the working directory via
Workspace...
- Add the
generateTestCases
task - Run the Gradle task configuration
generateTestCases
must be executed manually to generate the test cases - see Run Gradle tasks:
- Type
<CTRL><CTRL>
gradle generateTestCases
- Right click the
build/bpmndt
test sources folder and perform aReload from Disk
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-8-gradle-plugin:0.13.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.
Available properties:
Parameter | Type | Description | Default value |
---|---|---|---|
packageName | String | Package name, used for the generated test sources | generated |
The plugin's configuration is done in build.gradle
within the bpmndt
extension element:
bpmndt {
packageName = 'generated'
}
Add dependencies, which are required to execute the generated test code:
dependencies {
testImplementation 'io.camunda:zeebe-process-test-extension:8.6.3'
testImplementation 'org.junit.jupiter:junit-jupiter-api:5.10.1'
testCompileOnly 'org.immutables:annotate:2.10.0'
testCompileOnly 'org.immutables:value-annotations:2.10.0'
testRuntimeOnly 'org.junit.jupiter:junit-jupiter-engine:5.10.1'
}
test {
useJUnitPlatform()
}
Recommended versions:
Dependency | Version |
---|---|
Zeebe Process Test Extension | 8.6.3 |
JUnit 5 (Jupiter) | 5.10.1 |
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-8 -am
The Robot test report is written to target/robot/report.html
.