Skip to content
This repository was archived by the owner on Jun 11, 2025. It is now read-only.

Commit eff3a7e

Browse files
committed
Merge branch 'release/0.2.0'
2 parents 99ace5d + c218234 commit eff3a7e

File tree

22 files changed

+1193
-361
lines changed

22 files changed

+1193
-361
lines changed

.github/release-notes.yml

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
changelog:
2+
sections:
3+
- title: ":rocket: Enhancements & Features"
4+
labels: [ "Type: enhancement", "Type: documentation", "Type: example" ]
5+
- title: ":bug: Bug Fixes"
6+
labels: [ "Type: bug" ]
7+
- title: ":hammer_and_wrench: Chore"
8+
labels: [ "Type: dependencies" ]
9+
issues:
10+
exclude:
11+
labels: [ "Type: Incorrect Repository", "Type: question" ]
12+
contributors:
13+
exclude:
14+
names: [ "dependabot[bot]", "codacy-badger" ]

.github/workflows/default.yml

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,3 @@ jobs:
3838
- name: Build with Maven
3939
run: ./mvnw clean verify -U -B -T4
4040

41-
- name: Upolad coverage information
42-
uses: codecov/codecov-action@v1
43-
with:
44-
token: ${{ secrets.CODECOV_TOKEN }}

.github/workflows/master.yml

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -46,8 +46,3 @@ jobs:
4646
env:
4747
OSS_CENTRAL_USERNAME: ${{ secrets.SONATYPE_USERNAME }}
4848
OSS_CENTRAL_PASSWORD: ${{ secrets.SONATYPE_PASSWORD }}
49-
50-
- name: Upolad coverage information
51-
uses: codecov/codecov-action@v1
52-
with:
53-
token: ${{ secrets.CODECOV_TOKEN }}

.github/workflows/release-notes.yml

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
# Trigger the workflow on milestone events
2+
on:
3+
milestone:
4+
types: [closed]
5+
name: Milestone Closure
6+
jobs:
7+
create-release-notes:
8+
runs-on: ubuntu-latest
9+
steps:
10+
- name: Checkout code
11+
uses: actions/checkout@master
12+
- name: Create Release Notes Markdown
13+
uses: docker://decathlon/release-notes-generator-action:3.1.5
14+
env:
15+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # This token is provided by Actions, you do not need to create your own token
16+
OUTPUT_FOLDER: temp_release_notes
17+
USE_MILESTONE_TITLE: "true"
18+
- name: Get the name of the created Release Notes file and extract Version
19+
run: |
20+
RELEASE_NOTES_FILE=$(ls temp_release_notes/*.md | head -n 1)
21+
echo "RELEASE_NOTES_FILE=$RELEASE_NOTES_FILE" >> $GITHUB_ENV
22+
VERSION=$(echo ${{ github.event.milestone.title }} | cut -d' ' -f2)
23+
echo "VERSION=$VERSION" >> $GITHUB_ENV
24+
- name: Create a Draft Release Notes on GitHub
25+
id: create_release
26+
uses: actions/create-release@v1
27+
env:
28+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # This token is provided by Actions, you do not need to create your own token
29+
with:
30+
tag_name: ${{ env.VERSION }}
31+
release_name: ${{ env.VERSION }}
32+
body_path: ${{ env.RELEASE_NOTES_FILE }}
33+
draft: true

README.md

Lines changed: 117 additions & 70 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ Camunda specific stages and scenarios for the BDD testing tool JGiven written in
44

55
[![Development braches](https://github.com/holunda-io/camunda-bpm-jgiven/workflows/Development%20braches/badge.svg)](https://github.com/holunda-io/camunda-bpm-jgiven/workflows)
66
[![Maven Central](https://maven-badges.herokuapp.com/maven-central/io.holunda.testing/camunda-bpm-jgiven/badge.svg)](https://maven-badges.herokuapp.com/maven-central/io.holunda.testing/camunda-bpm-jgiven)
7-
[![codecov](https://codecov.io/gh/holunda-io/camunda-bpm-jgiven/branch/master/graph/badge.svg)](https://codecov.io/gh/holunda-io/camunda-bpm-jgiven)
87

98
[![Project Stats](https://www.openhub.net/p/camunda-bpm-jgiven/widgets/project_thin_badge.gif)](https://www.openhub.net/p/camunda-bpm-jgiven)
109

@@ -14,85 +13,139 @@ Starting from 2012, we are preaching that processes are no units. Behavior-drive
1413
underlying testing methodology of scenario-based testing is a way more adequate and convenient for writing
1514
process (model) tests.
1615

17-
Our first attempts addressed testing frameworks Cucumber and JBehave. For JBehave we were even able to release
18-
an official [Camunda BPM extension](https://github.com/camunda/camunda-bpm-jbehave). It turned out that the main problem
19-
in using it, was error-prone writing of the test specifications in Gherkin and glue code in Java.
16+
Our first attempts addressed testing frameworks Cucumber and JBehave. For JBehave we were able to release
17+
an official [Camunda BPM extension](https://github.com/camunda/camunda-bpm-jbehave), but it turned out that the main problem
18+
in using it, was error-prone writing of the test specifications in Gherkin (text files) and glue code them with Java.
2019

2120
This is, where [JGiven](http://jgiven.org/) comes on the scene, allowing to write both in Java or any other JVM language
22-
by providing a nice API and later generating reports which are human readable.
21+
by providing a nice API and later generating reports which are human-readable.
2322

2423
## Usage
2524

2625
Add the following dependency to your Maven pom:
2726

28-
<dependency>
29-
<groupId>io.holunda.testing</groupId>
30-
<artifactId>camunda-bpm-jgiven</artifactId>
31-
<version>0.0.7</version>
32-
<scope>test</scope>
33-
</dependency>
34-
27+
```xml
28+
<dependency>
29+
<groupId>io.holunda.testing</groupId>
30+
<artifactId>camunda-bpm-jgiven</artifactId>
31+
<version>0.2.0</version>
32+
<scope>test</scope>
33+
</dependency>
34+
```
3535
## Features
3636

3737
JGiven supports separation of the glue code (application driver) into so-called [stages](http://jgiven.org/userguide/#_stages_and_state_sharing).
3838
Stages contain assert and action methods and may be subclassed. This library provides a base class
3939
`ProcessStage` for building your process testing stages. Here is how the test then looks like
4040
(written in Kotlin):
4141

42+
### JUnit4
43+
44+
```kotlin
45+
@Deployment(resources = [ApprovalProcessBean.RESOURCE])
46+
open class ApprovalProcessTest : ScenarioTest<ApprovalProcessActionStage, ApprovalProcessActionStage, ApprovalProcessThenStage>() {
47+
48+
@get: Rule
49+
val rule: ProcessEngineRule = StandaloneInMemoryTestConfiguration().rule()
50+
51+
@ScenarioState
52+
val camunda = rule.processEngine
53+
4254
@Test
43-
fun `should automatically approve`() {
44-
45-
val approvalRequestId = UUID.randomUUID().toString()
46-
47-
given()
48-
.process_is_deployed(ApprovalProcessBean.KEY)
49-
.and()
50-
.process_is_started_for_request(approvalRequestId)
51-
.and()
52-
.approval_strategy_can_be_applied(Expressions.ApprovalStrategy.AUTOMATIC)
53-
.and()
54-
.automatic_approval_returns(Expressions.ApprovalDecision.APPROVE)
55-
56-
whenever()
57-
.process_continues()
58-
59-
then()
60-
.process_is_finished()
61-
.and()
62-
.process_has_passed(Elements.SERVICE_AUTO_APPROVE, Elements.END_APPROVED)
63-
55+
internal fun `should automatically approve`() {
56+
57+
val approvalRequestId = UUID.randomUUID().toString()
58+
59+
GIVEN
60+
.process_is_deployed(ApprovalProcessBean.KEY)
61+
.AND
62+
.process_is_started_for_request(approvalRequestId)
63+
.AND
64+
.approval_strategy_can_be_applied(Expressions.ApprovalStrategy.AUTOMATIC)
65+
.AND
66+
.automatic_approval_returns(Expressions.ApprovalDecision.APPROVE)
67+
68+
WHEN
69+
.process_continues()
70+
71+
THEN
72+
.process_is_finished()
73+
.AND
74+
.process_has_passed(Elements.SERVICE_AUTO_APPROVE, Elements.END_APPROVED)
75+
6476
}
77+
}
78+
```
79+
80+
### JUnit5
81+
82+
```kotlin
83+
@ExtendWith(ProcessEngineExtension::class)
84+
@Deployment(resources = [ApprovalProcessBean.RESOURCE])
85+
internal class ApprovalProcessTest :
86+
ScenarioTest<ApprovalProcessActionStage, ApprovalProcessActionStage, ApprovalProcessThenStage>() {
87+
88+
@RegisterExtension
89+
val extension = TestProcessEngine.DEFAULT
90+
91+
@ScenarioState
92+
val camunda = extension.processEngine
93+
94+
@Test
95+
internal fun `should automatically approve`() {
96+
97+
val approvalRequestId = UUID.randomUUID().toString()
98+
99+
GIVEN
100+
.process_is_deployed(ApprovalProcessBean.KEY)
101+
.AND
102+
.process_is_started_for_request(approvalRequestId)
103+
.AND
104+
.approval_strategy_can_be_applied(Expressions.ApprovalStrategy.AUTOMATIC)
105+
.AND
106+
.automatic_approval_returns(Expressions.ApprovalDecision.APPROVE)
107+
108+
WHEN
109+
.process_continues()
110+
111+
THEN
112+
.process_is_finished()
113+
.AND
114+
.process_has_passed(Elements.SERVICE_AUTO_APPROVE, Elements.END_APPROVED)
65115

66-
And here is the corresponding stage:
67-
68-
open class ApprovalProcessActionStage : ProcessStage<ApprovalProcessActionStage, ApprovalProcessBean>() {
69-
70-
@BeforeStage
71-
open fun `automock all delegates`() {
72-
CamundaMockito.registerJavaDelegateMock(DETERMINE_APPROVAL_STRATEGY)
73-
CamundaMockito.registerJavaDelegateMock(AUTOMATICALLY_APPROVE_REQUEST)
74-
CamundaMockito.registerJavaDelegateMock(ApprovalProcessBean.Expressions.LOAD_APPROVAL_REQUEST)
75-
}
76-
77-
open fun process_is_started_for_request(approvalRequestId: String): ApprovalProcessActionStage {
78-
processInstanceSupplier = ApprovalProcessBean(camunda.processEngine)
79-
processInstanceSupplier.start(approvalRequestId)
80-
assertThat(processInstanceSupplier.processInstance).isNotNull
81-
assertThat(processInstanceSupplier.processInstance).isStarted
82-
return self()
83-
}
84-
85-
fun approval_strategy_can_be_applied(approvalStrategy: String): ApprovalProcessActionStage {
86-
getJavaDelegateMock(DETERMINE_APPROVAL_STRATEGY).onExecutionSetVariables(Variables.putValue(APPROVAL_STRATEGY, approvalStrategy))
87-
return self()
88-
}
89-
90-
fun automatic_approval_returns(approvalDecision: String): ApprovalProcessActionStage {
91-
getJavaDelegateMock(AUTOMATICALLY_APPROVE_REQUEST).onExecutionSetVariables(Variables.putValue(APPROVAL_DECISION, approvalDecision))
92-
return self()
93-
}
94116
}
95-
117+
}
118+
```
119+
120+
Here is the corresponding stage, providing the steps used in the test:
121+
122+
```kotlin
123+
class ApprovalProcessActionStage : ProcessStage<ApprovalProcessActionStage, ApprovalProcessBean>() {
124+
125+
@BeforeStage
126+
fun `automock all delegates`() {
127+
CamundaMockito.registerJavaDelegateMock(DETERMINE_APPROVAL_STRATEGY)
128+
CamundaMockito.registerJavaDelegateMock(AUTOMATICALLY_APPROVE_REQUEST)
129+
CamundaMockito.registerJavaDelegateMock(ApprovalProcessBean.Expressions.LOAD_APPROVAL_REQUEST)
130+
}
131+
132+
fun process_is_started_for_request(approvalRequestId: String) = step {
133+
processInstanceSupplier = ApprovalProcessBean(camunda.processEngine)
134+
processInstanceSupplier.start(approvalRequestId)
135+
assertThat(processInstanceSupplier.processInstance).isNotNull
136+
assertThat(processInstanceSupplier.processInstance).isStarted
137+
}
138+
139+
fun approval_strategy_can_be_applied(approvalStrategy: String) = step {
140+
getJavaDelegateMock(DETERMINE_APPROVAL_STRATEGY).onExecutionSetVariables(Variables.putValue(APPROVAL_STRATEGY, approvalStrategy))
141+
}
142+
143+
fun automatic_approval_returns(approvalDecision: String) = step {
144+
getJavaDelegateMock(AUTOMATICALLY_APPROVE_REQUEST).onExecutionSetVariables(Variables.putValue(APPROVAL_DECISION, approvalDecision))
145+
}
146+
}
147+
```
148+
96149
The resulting report:
97150

98151
![JGiven Process Report](docs/report.png)
@@ -115,12 +168,8 @@ If you have permissions to release, make sure all branches are fetched and run:
115168
./mvnw gitflow:release-start
116169
./mvnw gitflow:release-finish
117170
118-
from cli. This will update the poms of `develop` and `master` branches.
119-
If you want to publish to central and have sufficient permissions, run
120-
121-
./mvnw clean deploy -Prelease -DskipExamples
122-
123-
on `master` branch. Don't forget to close and release repository on https://oss.sonatype.org/#stagingRepositories.
171+
from cli. This will update the poms of `develop` and `master` branches
172+
and start GitHub actions producing a new release.
124173

125174

126175
### Current maintainers
@@ -130,5 +179,3 @@ on `master` branch. Don't forget to close and release repository on https://oss.
130179
* [Jan Galinski](https://github.com/jangalinski)
131180
* [Andre Hegerath](https://github.com/a-hegerath)
132181
* [Stefan Zilske](https://github.com/stefanzilske)
133-
134-

examples/basic-junit5/pom.xml

Lines changed: 81 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,81 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
3+
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
4+
<modelVersion>4.0.0</modelVersion>
5+
6+
<parent>
7+
<groupId>io.holunda.testing</groupId>
8+
<artifactId>camunda-bpm-jgiven-examples</artifactId>
9+
<version>0.2.0</version>
10+
</parent>
11+
12+
<artifactId>camunda-bpm-jgiven-examples-basic-junit5</artifactId>
13+
<packaging>jar</packaging>
14+
15+
<dependencies>
16+
<dependency>
17+
<groupId>org.camunda.bpm.springboot</groupId>
18+
<artifactId>camunda-bpm-spring-boot-starter-webapp</artifactId>
19+
</dependency>
20+
<dependency>
21+
<groupId>com.h2database</groupId>
22+
<artifactId>h2</artifactId>
23+
</dependency>
24+
<dependency>
25+
<groupId>org.camunda.bpm.extension.mockito</groupId>
26+
<artifactId>camunda-bpm-mockito</artifactId>
27+
<version>5.16.0</version>
28+
<scope>test</scope>
29+
</dependency>
30+
<dependency>
31+
<groupId>org.camunda.bpm.springboot</groupId>
32+
<artifactId>camunda-bpm-spring-boot-starter-test</artifactId>
33+
<scope>test</scope>
34+
<exclusions>
35+
<exclusion>
36+
<groupId>org.camunda.bpm.assert</groupId>
37+
<artifactId>camunda-bpm-assert-assertj3-11-1</artifactId>
38+
</exclusion>
39+
</exclusions>
40+
</dependency>
41+
<dependency>
42+
<groupId>org.camunda.bpm.assert</groupId>
43+
<artifactId>camunda-bpm-assert</artifactId>
44+
<scope>test</scope>
45+
</dependency>
46+
<dependency>
47+
<groupId>org.camunda.bpm.extension</groupId>
48+
<artifactId>camunda-bpm-junit5</artifactId>
49+
<version>1.1.0</version>
50+
<scope>test</scope>
51+
</dependency>
52+
<dependency>
53+
<groupId>io.holunda.testing</groupId>
54+
<artifactId>camunda-bpm-jgiven</artifactId>
55+
<scope>test</scope>
56+
</dependency>
57+
<dependency>
58+
<groupId>org.camunda.bpm.extension</groupId>
59+
<artifactId>camunda-bpm-process-test-coverage</artifactId>
60+
<version>0.4.0</version>
61+
<scope>test</scope>
62+
</dependency>
63+
</dependencies>
64+
65+
<build>
66+
<plugins>
67+
<plugin>
68+
<!-- kotlin compiler -->
69+
<artifactId>kotlin-maven-plugin</artifactId>
70+
<groupId>org.jetbrains.kotlin</groupId>
71+
</plugin>
72+
<plugin>
73+
<!-- report with JGiven -->
74+
<groupId>com.tngtech.jgiven</groupId>
75+
<artifactId>jgiven-maven-plugin</artifactId>
76+
</plugin>
77+
</plugins>
78+
</build>
79+
80+
81+
</project>

0 commit comments

Comments
 (0)