Skip to content

Commit ef194cc

Browse files
authored
[JUnit Platform Engine] Add architecture diagrams (#2964)
Fixes: #2897
1 parent 8b588ca commit ef194cc

File tree

1 file changed

+49
-12
lines changed

1 file changed

+49
-12
lines changed

cucumber-junit-platform-engine/README.md

Lines changed: 49 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -3,23 +3,41 @@ Cucumber JUnit Platform Engine
33

44
Use the JUnit (5) Platform to execute Cucumber scenarios.
55

6-
Add the `cucumber-junit-platform-engine` dependency to your `pom.xml`:
6+
Add the `cucumber-junit-platform-engine` dependency to your `pom.xml` and use
7+
the [`cucumber-bom`](../cucumber-bom/README.md) for dependency management:
78

89
```xml
910
<dependency>
1011
<groupId>io.cucumber</groupId>
1112
<artifactId>cucumber-junit-platform-engine</artifactId>
12-
<version>${cucumber.version}</version>
1313
<scope>test</scope>
1414
</dependency>
1515
```
1616

1717
This will allow IntelliJ IDEA, Eclipse, Maven, Gradle, etc, to discover, select
1818
and execute Cucumber scenarios.
1919

20-
## Surefire and Gradle workarounds
20+
## Running Cucumber
2121

22-
Maven, Surefire and Gradle do not yet support discovery of non-class based tests
22+
The JUnit Platform provides a single interface for tools and IDE's to discover,
23+
select and execute tests from different test engines. Conceptually this looks
24+
like this:
25+
26+
27+
```mermaid
28+
erDiagram
29+
"IDE, Maven, Gradle or Console Launcher" ||--|{ "JUnit Platform" : "requests discovery and execution"
30+
"Console Launcher" ||--|{ "JUnit Platform" : "requests discovery and execution"
31+
"JUnit Platform" ||--|{ "Cucumber Test Engine": "forwards request"
32+
"JUnit Platform" ||--|{ "Jupiter Test Engine": "forwards request"
33+
"Cucumber Test Engine" ||--|{ "Feature Files": "discovers and executes"
34+
"Jupiter Test Engine" ||--|{ "Test Classes": "discovers and executes"
35+
```
36+
37+
38+
### Maven Surefire and Gradle
39+
40+
Maven Surefire and Gradle do not yet support discovery of non-class based tests
2341
(see: [gradle/#4773](https://github.com/gradle/gradle/issues/4773),
2442
[SUREFIRE-1724](https://issues.apache.org/jira/browse/SUREFIRE-1724)). As a
2543
workaround, you can either use:
@@ -28,7 +46,7 @@ Maven, Surefire and Gradle do not yet support discovery of non-class based tests
2846
* the [Gradle Cucumber-Companion](https://github.com/gradle/cucumber-companion) plugins for Gradle and Maven.
2947
* the [Cucable](https://github.com/trivago/cucable-plugin) plugin for Maven.
3048

31-
### Use the JUnit Platform Suite Engine
49+
#### Use the JUnit Platform Suite Engine
3250

3351
The JUnit Platform Suite Engine can be used to run Cucumber. See
3452
[Suites with different configurations](#suites-with-different-configurations)
@@ -40,7 +58,7 @@ can make for hard to read reports. To improve the readability of the reports
4058
provide the `cucumber.junit-platform.naming-strategy=long` configuration
4159
parameter. This will include the feature name as part of the test name.
4260

43-
#### Maven
61+
##### Maven
4462

4563
```xml
4664
<plugin>
@@ -57,7 +75,7 @@ parameter. This will include the feature name as part of the test name.
5775
</plugin>
5876
```
5977

60-
#### Gradle
78+
##### Gradle
6179

6280
```kotlin
6381
tasks.test {
@@ -66,12 +84,12 @@ tasks.test {
6684
}
6785
```
6886

69-
### Use the JUnit Console Launcher ###
87+
#### Use the JUnit Console Launcher ###
7088

7189
You can integrate the JUnit Platform Console Launcher in your build by using
7290
either the Maven Antrun plugin or the Gradle JavaExec task.
7391

74-
#### Use the Maven Antrun plugin ####
92+
##### Use the Maven Antrun plugin ####
7593

7694
Add the following to your `pom.xml`:
7795

@@ -121,7 +139,7 @@ Add the following to your `pom.xml`:
121139
</plugins>
122140
</build>
123141
```
124-
#### Use the Gradle JavaExec task ####
142+
##### Use the Gradle JavaExec task ####
125143

126144
Add the following to your `build.gradle.kts`:
127145

@@ -167,13 +185,30 @@ TODO: (I don't know how. Feel free to send a pull request. ;))
167185
## Suites with different configurations
168186

169187
The JUnit Platform Suite Engine can be used to run Cucumber multiple times with
170-
different configurations. Add the `junit-platform-suite` dependency:
188+
different configurations. Conceptually this looks like this:
189+
190+
```mermaid
191+
erDiagram
192+
"IDE, Maven, Gradle or Console Launcher" ||--|{ "JUnit Platform" : "requests discovery and execution"
193+
"JUnit Platform" ||--|{ "Suite Test Engine": "forwards request"
194+
"Suite Test Engine" ||--|{ "@Suite annotated class A" : "discovers and executes"
195+
"Suite Test Engine" ||--|{ "@Suite annotated class B" : "discovers and executes"
196+
197+
"@Suite annotated class A" ||--|{ "JUnit Platform (A)" : "requests discovery and execution"
198+
"@Suite annotated class B" ||--|{ "JUnit Platform (B)" : "requests discovery and execution"
199+
"JUnit Platform (A)" ||--|{ "Cucumber Test Engine (A)": "forwards request"
200+
"JUnit Platform (B)" ||--|{ "Cucumber Test Engine (B)": "forwards request"
201+
"Cucumber Test Engine (A)" ||--|{ "Feature Files (A)": "discovers and executes"
202+
"Cucumber Test Engine (B)" ||--|{ "Feature Files (B)": "discovers and executes"
203+
```
204+
205+
To use, add the `junit-platform-suite` dependency and use
206+
the [`cucumber-bom`](../cucumber-bom/README.md) for dependency management:
171207

172208
```xml
173209
<dependency>
174210
<groupId>org.junit.platform</groupId>
175211
<artifactId>junit-platform-suite</artifactId>
176-
<version>${junit-platform.version}</version>
177212
<scope>test</scope>
178213
</dependency>
179214
```
@@ -200,6 +235,8 @@ public class RunCucumberTest {
200235
}
201236
```
202237

238+
239+
203240
## Parallel execution ##
204241

205242
By default, Cucumber runs tests sequentially in a single thread. Running tests

0 commit comments

Comments
 (0)