You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When using Gradle, tags can be selected through the [build configuration](https://docs.gradle.org/current/userguide/java_testing.html#test_grouping). These take a [JUnit5 Tag Expression](https://junit.org/junit5/docs/current/user-guide/#running-tests-tag-expressions).
92
+
Note: When using JUnit, the `@` is not part of the tag.
93
+
94
+
```kotlin
95
+
tasks.withType<Test>().configureEach {
96
+
useJUnitPlatform {
97
+
includeTags("Zucchini | Gherkin")
98
+
excludeTags("Haricots")
99
+
}
100
+
}
101
+
```
102
+
103
+
### By line
104
+
105
+
#### With the JUnit Suite Engine
106
+
107
+
Specify a particular scenario by *line*
92
108
93
-
Maven and Gradle do not (yet) support selecting single features or scenarios
109
+
@SelectClasspathResource(value = "io/cucumber/skeleton/belly.feature", line = 3)
110
+
111
+
In case you have multiple feature files or scenarios to run against repeat the
112
+
annotation.
113
+
114
+
#### With Maven
115
+
116
+
Maven does not (yet) support selecting single features or scenarios
94
117
with JUnit selectors. As a work around the `cucumber.features` property can be
95
118
used. Because this property will cause Cucumber to ignore any other selectors
96
119
from JUnit it is prudent to only execute the Cucumber engine.
97
120
98
-
#### With Maven
99
-
100
121
To select the scenario on line 3 of the `belly.feature` file use:
101
122
102
-
```
123
+
```shell
103
124
./mvnw test -Dsurefire.includeJUnit5Engines=cucumber -Dcucumber.features=src/test/resources/io/cucumber/skeleton/belly.feature:3
104
125
```
105
126
106
127
Note: Add `-Dcucumber.plugin=pretty` to get a more detailed output during test execution.
107
128
108
129
#### With Gradle
109
130
110
-
TODO: (I don't know how to do this. Feel free to send a pull request. ;))
131
+
Gradle does not (yet) support selecting single features or scenarios
132
+
with JUnit selectors. As a work around the `cucumber.features` property can be
133
+
used. Because this property will cause Cucumber to ignore any other selectors
134
+
from JUnit it is prudent to only execute the Cucumber engine.
135
+
136
+
```shell
137
+
./gradlew test --rerun-tasks --info -Dcucumber.features=src/test/resources/io/cucumber/skeleton/belly.feature:3
138
+
```
139
+
140
+
Note: Add `-Dcucumber.plugin=pretty` to get a more detailed output during test execution.
141
+
Note: Because both the Suite Engine and the Cucumber Engine are included, this
142
+
will run tests twice. (If you know how to prevent this, please send a pull
0 commit comments