Skip to content

Commit a1ab42c

Browse files
authored
Document workaround deduplicate cucumber and junit-platform.properties (#3017)
1 parent 07afae9 commit a1ab42c

File tree

1 file changed

+24
-9
lines changed

1 file changed

+24
-9
lines changed

cucumber-junit-platform-engine/README.md

Lines changed: 24 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ erDiagram
3535
"Jupiter Test Engine" ||--|{ "Test Classes": "discovers and executes"
3636
```
3737

38+
In practice, integration is still limited so we discuss the most common workarounds below.
3839

3940
### Maven Surefire and Gradle
4041

@@ -53,15 +54,15 @@ The JUnit Platform Suite Engine can be used to run Cucumber. See
5354
[Suites with different configurations](#suites-with-different-configurations)
5455
for a brief how to.
5556

57+
##### Maven and Gradle workarounds
58+
5659
Because Surefire and Gradle reports provide the results in a `<Class Name> - <Method Name>`
5760
format, only scenario names or example numbers are reported. This
5861
can make for hard to read reports.
5962

60-
To improve the readability of the reports provide the
61-
`cucumber.junit-platform.naming-strategy` configuration parameter to
62-
Gradle. This will include the feature name as part of the test name.
63-
64-
##### Maven
63+
To improve the readability of the reports use the
64+
`cucumber.junit-platform.naming-strategy` configuration parameter. This will
65+
include the feature name, scenario name, example number, ect in the report.
6566

6667
```xml
6768
<plugin>
@@ -78,15 +79,31 @@ Gradle. This will include the feature name as part of the test name.
7879
</plugin>
7980
```
8081

81-
##### Gradle
82-
8382
```kotlin
8483
tasks.test {
8584
useJUnitPlatform()
8685
systemProperty("cucumber.junit-platform.naming-strategy", "long")
8786
}
8887
```
8988

89+
##### IDEA workarounds
90+
91+
When running features through IDEA, the Cucumber CLI is used. The CLI looks for
92+
configuration properties in `cucumber.properties` while JUnit looks for
93+
`junit-platform.properties`. To avoid duplication you can use the
94+
`@ConfigurationParametersResource` annotation to include `cucumber.properties`
95+
into a Suite.
96+
97+
```java
98+
@Suite
99+
@IncludeEngines("cucumber")
100+
@SelectPackages("com.example")
101+
@ConfigurationParameter(key = GLUE_PROPERTY_NAME, value = "com.example")
102+
@ConfigurationParametersResource("cucumber.properties")
103+
public class RunCucumberTest {
104+
}
105+
```
106+
90107
#### Use the JUnit Console Launcher ###
91108

92109
You can integrate the JUnit Platform Console Launcher in your build by using
@@ -259,8 +276,6 @@ public class RunCucumberTest {
259276
}
260277
```
261278

262-
263-
264279
## Parallel execution ##
265280

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

0 commit comments

Comments
 (0)