Skip to content

Commit f75916b

Browse files
committed
[JUnit Platform Engine] Document rerunning with Maven and Gradle
1 parent 461ca50 commit f75916b

File tree

1 file changed

+56
-2
lines changed

1 file changed

+56
-2
lines changed

cucumber-junit-platform-engine/README.md

+56-2
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ parameter. This will include the feature name as part of the test name.
4646
<plugin>
4747
<groupId>org.apache.maven.plugins</groupId>
4848
<artifactId>maven-surefire-plugin</artifactId>
49-
<version>3.0.0-M5</version>
49+
<version>3.2.5</version>
5050
<configuration>
5151
<properties>
5252
<configurationParameters>
@@ -521,7 +521,61 @@ public class RpnCalculatorSteps {
521521
## Rerunning Failed Scenarios ##
522522

523523
When using `cucumber-junit-platform-engine` rerun files are not supported.
524-
However, the JUnit Platform allows you to rerun failed tests through its API.
524+
Use either Maven, Gradle or the JUnit Platform Launcher API.
525+
526+
### Using Maven
527+
528+
When running Cucumber through the [JUnit Platform Suite Engine](use-the-jUnit-platform-suite-engine)
529+
use [`rerunFailingTestsCount`](https://maven.apache.org/surefire/maven-surefire-plugin/examples/rerun-failing-tests.html).
530+
531+
Note: any files written by Cucumber will be overwritten during the rerun.
532+
533+
```xml
534+
<plugin>
535+
<groupId>org.apache.maven.plugins</groupId>
536+
<artifactId>maven-surefire-plugin</artifactId>
537+
<version>3.2.5</version>
538+
<configuration>
539+
<rerunFailingTestsCount>2</rerunFailingTestsCount>
540+
<properties>
541+
<!-- Work around. Surefire does not include enough
542+
information to disambiguate between different
543+
examples and scenarios. -->
544+
<configurationParameters>
545+
cucumber.junit-platform.naming-strategy=long
546+
</configurationParameters>
547+
</properties>
548+
</configuration>
549+
</plugin>
550+
```
551+
552+
### Using Gradle.
553+
554+
When running Cucumber through the [JUnit Platform Suite Engine](use-the-jUnit-platform-suite-engine)
555+
use the [`test-retry`](https://github.com/gradle/test-retry-gradle-plugin) plugin to rerun tests.
556+
557+
Note: any files written by Cucumber will be overwritten during the rerun.
558+
559+
```kotlin
560+
plugins {
561+
java
562+
id("org.gradle.test-retry") version "1.5.8"
563+
}
564+
...
565+
tasks.withType<Test> {
566+
useJUnitPlatform()
567+
// Work around. Gradle does not include enough information to disambiguate
568+
// between different examples and scenarios.
569+
systemProperty("cucumber.junit-platform.naming-strategy", "long")
570+
571+
retry {
572+
maxRetries.set(2)
573+
}
574+
575+
}
576+
```
577+
578+
### Using the JUnit Platform Launcher API
525579

526580
```java
527581
package com.example;

0 commit comments

Comments
 (0)