-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
61 changed files
with
2,337 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
* Settings | ||
Library OperatingSystem | ||
Library Process | ||
|
||
* Test Cases | ||
mvn clean test | ||
[Tags] xignore maven | ||
${result}= Run process | ||
... mvn -B -f ${CURDIR}/advanced-multi-instance/pom.xml clean test -Dplugin.version\=${VERSION} | ||
... shell=True stdout=${TEMP}/advanced-multi-instance.out stderr=STDOUT | ||
|
||
Log ${result.stdout} | ||
|
||
# plugin executed | ||
Should contain ${result.stdout} bpmn-driven-testing-8-maven-plugin:${VERSION}:generator | ||
|
||
# tests executed | ||
Should contain ${result.stdout} Running org.example.it.ParallelTest | ||
Should contain ${result.stdout} Running org.example.it.ScopeErrorEndEventTest | ||
Should contain ${result.stdout} Running org.example.it.ScopeNestedTest | ||
Should contain ${result.stdout} Running org.example.it.ScopeParallelTest | ||
Should contain ${result.stdout} Running org.example.it.ScopeSequentialTest | ||
Should contain ${result.stdout} Running org.example.it.ScopeZeroTest | ||
Should contain ${result.stdout} Running org.example.it.SequentialTest | ||
Should contain ${result.stdout} Running org.example.it.UserTaskErrorTest | ||
Should contain ${result.stdout} Running org.example.it.UserTaskMessageTest | ||
# tests executed successfully | ||
Should contain ${result.stdout} Failures: 0, Errors: 0, Skipped: 1 | ||
|
||
Should be equal as integers ${result.rc} 0 | ||
|
||
gradle clean build | ||
[Tags] xignore gradle | ||
${result}= Run process | ||
... gradle -p ${CURDIR}/advanced-multi-instance clean build -Pplugin.version\=${VERSION} --info --stacktrace | ||
... shell=True stdout=${TEMP}/advanced-multi-instance.out stderr=STDOUT | ||
|
||
Log ${result.stdout} | ||
|
||
# task executed | ||
Should contain ${result.stdout} > Task :generateTestCases | ||
|
||
# tests executed | ||
Should contain ${result.stdout} finished executing tests | ||
# tests executed successfully | ||
Should contain ${result.stdout} Failures: 0, Skipped: 1 | ||
|
||
Should be equal as integers ${result.rc} 0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
plugins { | ||
id 'java' | ||
id 'org.camunda.community.bpmndt' | ||
} | ||
|
||
repositories { | ||
mavenLocal() | ||
mavenCentral() | ||
} | ||
|
||
dependencies { | ||
testImplementation 'io.camunda:zeebe-process-test-extension:8.4.4' | ||
testImplementation 'org.junit.jupiter:junit-jupiter-api:5.10.1' | ||
testImplementation 'com.google.truth:truth:1.1.5' | ||
|
||
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' | ||
} | ||
|
||
compileJava { | ||
options.release = 21 | ||
} | ||
|
||
test { | ||
useJUnitPlatform() | ||
|
||
testLogging { | ||
afterSuite { desc, result -> | ||
if (!desc.parent) { | ||
println "Tests run: ${result.testCount}, Failures: ${result.failedTestCount}, Skipped: ${result.skippedTestCount}" | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,113 @@ | ||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> | ||
<modelVersion>4.0.0</modelVersion> | ||
|
||
<groupId>org.example.it</groupId> | ||
<artifactId>bpmndt-advanced-multi-instance-8</artifactId> | ||
<version>1</version> | ||
|
||
<properties> | ||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> | ||
|
||
<!-- Versions --> | ||
<camunda.zeebe.version>8.4.4</camunda.zeebe.version> | ||
<google.truth.version>1.1.5</google.truth.version> | ||
<junit.jupiter.version>5.10.1</junit.jupiter.version> | ||
<slf4j.version>1.7.36</slf4j.version> | ||
|
||
<plugin.version>0.11.0-SNAPSHOT</plugin.version> | ||
</properties> | ||
|
||
<repositories> | ||
<repository> | ||
<id>camunda-bpm-nexus</id> | ||
<name>camunda-bpm-nexus</name> | ||
<url>https://artifacts.camunda.com/artifactory/public/</url> | ||
</repository> | ||
</repositories> | ||
|
||
<dependencies> | ||
<dependency> | ||
<groupId>org.immutables</groupId> | ||
<artifactId>annotate</artifactId> | ||
<version>2.10.0</version> | ||
<scope>provided</scope> | ||
</dependency> | ||
<dependency> | ||
<groupId>org.immutables</groupId> | ||
<artifactId>value-annotations</artifactId> | ||
<version>2.10.0</version> | ||
<scope>provided</scope> | ||
</dependency> | ||
|
||
<!-- Test --> | ||
<dependency> | ||
<groupId>io.camunda</groupId> | ||
<artifactId>zeebe-process-test-extension</artifactId> | ||
<version>${camunda.zeebe.version}</version> | ||
</dependency> | ||
|
||
<dependency> | ||
<groupId>org.slf4j</groupId> | ||
<artifactId>slf4j-api</artifactId> | ||
<version>${slf4j.version}</version> | ||
<scope>test</scope> | ||
</dependency> | ||
<dependency> | ||
<groupId>org.slf4j</groupId> | ||
<artifactId>slf4j-reload4j</artifactId> | ||
<version>${slf4j.version}</version> | ||
<scope>test</scope> | ||
</dependency> | ||
|
||
<dependency> | ||
<groupId>org.junit.jupiter</groupId> | ||
<artifactId>junit-jupiter-api</artifactId> | ||
<version>${junit.jupiter.version}</version> | ||
<scope>test</scope> | ||
</dependency> | ||
|
||
<dependency> | ||
<groupId>com.google.truth</groupId> | ||
<artifactId>truth</artifactId> | ||
<version>${google.truth.version}</version> | ||
<scope>test</scope> | ||
<exclusions> | ||
<exclusion> | ||
<groupId>junit</groupId> | ||
<artifactId>junit</artifactId> | ||
</exclusion> | ||
</exclusions> | ||
</dependency> | ||
</dependencies> | ||
|
||
<build> | ||
<plugins> | ||
<plugin> | ||
<artifactId>maven-compiler-plugin</artifactId> | ||
<version>3.8.1</version> | ||
<configuration> | ||
<release>21</release> | ||
</configuration> | ||
</plugin> | ||
|
||
<plugin> | ||
<groupId>org.apache.maven.plugins</groupId> | ||
<artifactId>maven-surefire-plugin</artifactId> | ||
<version>3.0.0-M6</version> | ||
</plugin> | ||
|
||
<plugin> | ||
<groupId>org.camunda.community</groupId> | ||
<artifactId>bpmn-driven-testing-8-maven-plugin</artifactId> | ||
<version>${plugin.version}</version> | ||
<executions> | ||
<execution> | ||
<goals> | ||
<goal>generator</goal> | ||
</goals> | ||
</execution> | ||
</executions> | ||
</plugin> | ||
</plugins> | ||
</build> | ||
</project> |
19 changes: 19 additions & 0 deletions
19
integration-tests-8/advanced-multi-instance/settings.gradle
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
pluginManagement { | ||
plugins { | ||
id 'org.camunda.community.bpmndt' | ||
} | ||
|
||
resolutionStrategy { | ||
eachPlugin { | ||
if (requested.id.toString() == 'org.camunda.community.bpmndt') { | ||
def pluginVersion = startParameter.projectProperties['plugin.version'] ?: '0.11.0-SNAPSHOT' | ||
useModule("org.camunda.community:bpmn-driven-testing-8-gradle-plugin:${pluginVersion}") | ||
} | ||
} | ||
} | ||
|
||
repositories { | ||
mavenLocal() | ||
mavenCentral() | ||
} | ||
} |
30 changes: 30 additions & 0 deletions
30
integration-tests-8/advanced-multi-instance/src/test/java/org/example/it/ParallelTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
package org.example.it; | ||
|
||
import java.util.List; | ||
|
||
import org.junit.jupiter.api.Test; | ||
import org.junit.jupiter.api.extension.RegisterExtension; | ||
|
||
import generated.parallel.TC_startEvent__endEvent; | ||
import io.camunda.zeebe.process.test.api.ZeebeTestEngine; | ||
import io.camunda.zeebe.process.test.assertions.ProcessInstanceAssert; | ||
import io.camunda.zeebe.process.test.extension.ZeebeProcessTest; | ||
|
||
@ZeebeProcessTest | ||
class ParallelTest { | ||
|
||
@RegisterExtension | ||
TC_startEvent__endEvent tc = new TC_startEvent__endEvent(); | ||
|
||
ZeebeTestEngine engine; | ||
|
||
@Test | ||
void testExecute() { | ||
tc.handleMultiInstanceManualTask().verifyParallel(); | ||
|
||
tc.createExecutor(engine) | ||
.withVariable("elements", List.of(1, 2, 3)) | ||
.verify(ProcessInstanceAssert::isCompleted) | ||
.execute(); | ||
} | ||
} |
41 changes: 41 additions & 0 deletions
41
...-tests-8/advanced-multi-instance/src/test/java/org/example/it/ScopeErrorEndEventTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
package org.example.it; | ||
|
||
import java.util.List; | ||
|
||
import org.junit.jupiter.api.Test; | ||
import org.junit.jupiter.api.extension.RegisterExtension; | ||
|
||
import generated.scopeerrorendevent.TC_Error; | ||
import generated.scopeerrorendevent.TC_None; | ||
import io.camunda.zeebe.process.test.api.ZeebeTestEngine; | ||
import io.camunda.zeebe.process.test.assertions.ProcessInstanceAssert; | ||
import io.camunda.zeebe.process.test.extension.ZeebeProcessTest; | ||
|
||
@ZeebeProcessTest | ||
class ScopeErrorEndEventTest { | ||
|
||
@RegisterExtension | ||
TC_None tc = new TC_None(); | ||
@RegisterExtension | ||
TC_Error tcError = new TC_Error(); | ||
|
||
ZeebeTestEngine engine; | ||
|
||
@Test | ||
void testExecute() { | ||
tc.createExecutor(engine) | ||
.withVariable("elements", List.of(1, 2, 3)) | ||
.withVariable("error", false) | ||
.verify(ProcessInstanceAssert::isCompleted) | ||
.execute(); | ||
} | ||
|
||
@Test | ||
void testExecuteError() { | ||
tcError.createExecutor(engine) | ||
.withVariable("elements", List.of(1, 2, 3)) | ||
.withVariable("error", true) | ||
.verify(ProcessInstanceAssert::isCompleted) | ||
.execute(); | ||
} | ||
} |
51 changes: 51 additions & 0 deletions
51
...gration-tests-8/advanced-multi-instance/src/test/java/org/example/it/ScopeNestedTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
package org.example.it; | ||
|
||
import java.util.List; | ||
|
||
import org.camunda.community.bpmndt.api.CustomMultiInstanceHandler; | ||
import org.camunda.community.bpmndt.api.UserTaskHandler; | ||
import org.junit.jupiter.api.Test; | ||
import org.junit.jupiter.api.extension.RegisterExtension; | ||
|
||
import generated.scopenested.TC_startEvent__endEvent; | ||
import io.camunda.zeebe.process.test.api.ZeebeTestEngine; | ||
import io.camunda.zeebe.process.test.assertions.ProcessInstanceAssert; | ||
import io.camunda.zeebe.process.test.extension.ZeebeProcessTest; | ||
|
||
@ZeebeProcessTest | ||
class ScopeNestedTest { | ||
|
||
@RegisterExtension | ||
TC_startEvent__endEvent tc = new TC_startEvent__endEvent(); | ||
|
||
ZeebeTestEngine engine; | ||
|
||
@Test | ||
void testExecute() { | ||
var elements = List.of(1, 2, 3); | ||
var nestedElements = List.of(4, 5); | ||
|
||
tc.handleSubProcess().execute((testCaseInstance, processInstanceKey) -> { | ||
var nestedSubProcessHandler = new CustomMultiInstanceHandler("nestedSubProcess"); | ||
|
||
nestedSubProcessHandler.execute((__, ___) -> { | ||
var userTaskHandler = new UserTaskHandler("userTask"); | ||
|
||
for (int i = 0; i < nestedElements.size(); i++) { | ||
testCaseInstance.apply(processInstanceKey, userTaskHandler); | ||
} | ||
}); | ||
|
||
for (int i = 0; i < elements.size(); i++) { | ||
testCaseInstance.apply(processInstanceKey, nestedSubProcessHandler); | ||
} | ||
}); | ||
|
||
tc.createExecutor(engine) | ||
.simulateProcess("advanced") | ||
.withVariable("elements", elements) | ||
.withVariable("nestedElements", nestedElements) | ||
.verify(ProcessInstanceAssert::isCompleted) | ||
.execute(); | ||
} | ||
} |
Oops, something went wrong.