@@ -3,23 +3,41 @@ Cucumber JUnit Platform Engine
3
3
4
4
Use the JUnit (5) Platform to execute Cucumber scenarios.
5
5
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:
7
8
8
9
``` xml
9
10
<dependency >
10
11
<groupId >io.cucumber</groupId >
11
12
<artifactId >cucumber-junit-platform-engine</artifactId >
12
- <version >${cucumber.version}</version >
13
13
<scope >test</scope >
14
14
</dependency >
15
15
```
16
16
17
17
This will allow IntelliJ IDEA, Eclipse, Maven, Gradle, etc, to discover, select
18
18
and execute Cucumber scenarios.
19
19
20
- ## Surefire and Gradle workarounds
20
+ ## Running Cucumber
21
21
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
23
41
(see: [ gradle/#4773 ] ( https://github.com/gradle/gradle/issues/4773 ) ,
24
42
[ SUREFIRE-1724] ( https://issues.apache.org/jira/browse/SUREFIRE-1724 ) ). As a
25
43
workaround, you can either use:
@@ -28,7 +46,7 @@ Maven, Surefire and Gradle do not yet support discovery of non-class based tests
28
46
* the [ Gradle Cucumber-Companion] ( https://github.com/gradle/cucumber-companion ) plugins for Gradle and Maven.
29
47
* the [ Cucable] ( https://github.com/trivago/cucable-plugin ) plugin for Maven.
30
48
31
- ### Use the JUnit Platform Suite Engine
49
+ #### Use the JUnit Platform Suite Engine
32
50
33
51
The JUnit Platform Suite Engine can be used to run Cucumber. See
34
52
[ 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
40
58
provide the ` cucumber.junit-platform.naming-strategy=long ` configuration
41
59
parameter. This will include the feature name as part of the test name.
42
60
43
- #### Maven
61
+ ##### Maven
44
62
45
63
``` xml
46
64
<plugin >
@@ -57,7 +75,7 @@ parameter. This will include the feature name as part of the test name.
57
75
</plugin >
58
76
```
59
77
60
- #### Gradle
78
+ ##### Gradle
61
79
62
80
``` kotlin
63
81
tasks.test {
@@ -66,12 +84,12 @@ tasks.test {
66
84
}
67
85
```
68
86
69
- ### Use the JUnit Console Launcher ###
87
+ #### Use the JUnit Console Launcher ###
70
88
71
89
You can integrate the JUnit Platform Console Launcher in your build by using
72
90
either the Maven Antrun plugin or the Gradle JavaExec task.
73
91
74
- #### Use the Maven Antrun plugin ####
92
+ ##### Use the Maven Antrun plugin ####
75
93
76
94
Add the following to your ` pom.xml ` :
77
95
@@ -121,7 +139,7 @@ Add the following to your `pom.xml`:
121
139
</plugins >
122
140
</build >
123
141
```
124
- #### Use the Gradle JavaExec task ####
142
+ ##### Use the Gradle JavaExec task ####
125
143
126
144
Add the following to your ` build.gradle.kts ` :
127
145
@@ -167,13 +185,30 @@ TODO: (I don't know how. Feel free to send a pull request. ;))
167
185
## Suites with different configurations
168
186
169
187
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:
171
207
172
208
``` xml
173
209
<dependency >
174
210
<groupId >org.junit.platform</groupId >
175
211
<artifactId >junit-platform-suite</artifactId >
176
- <version >${junit-platform.version}</version >
177
212
<scope >test</scope >
178
213
</dependency >
179
214
```
@@ -200,6 +235,8 @@ public class RunCucumberTest {
200
235
}
201
236
```
202
237
238
+
239
+
203
240
## Parallel execution ##
204
241
205
242
By default, Cucumber runs tests sequentially in a single thread. Running tests
0 commit comments