Skip to content

Commit 4764462

Browse files
committed
Update for number-and-pickle-if-parameterized
1 parent 0919b68 commit 4764462

File tree

5 files changed

+23
-11
lines changed

5 files changed

+23
-11
lines changed

cucumber-junit-platform-engine/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -433,7 +433,7 @@ cucumber.junit-platform.naming-strategy.long.example-name= # number, number-
433433
# long naming strategy is used
434434
435435
cucumber.junit-platform.naming-strategy.surefire.example-name= # number or pickle.
436-
# default: number
436+
# default: number-and-pickle-if-parameterized
437437
# Use example number or pickle name for examples when
438438
# surefire naming strategy is used
439439

cucumber-junit-platform-engine/src/main/java/io/cucumber/junit/platform/engine/Constants.java

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -135,11 +135,11 @@ public final class Constants {
135135
* {@code Feature Name - Rule Name - Scenario Name - Examples Name - Example #N }.
136136
* This is useful for tools that only report the test name such as Gradle.
137137
* <p>
138-
* When the {@code surefire} naming strategy is used nodes are named such
139-
* that the Surefire makes sense. The feature name will be rendered as the
140-
* class name. The long name without the feature will be rendered as the
141-
* test\ method name. For example:
142-
* {@code Feature Name.Rule Name - Scenario Name - Examples Name - Example #N }.
138+
* When the {@code surefire} naming strategy is used nodes are named such that
139+
* the Surefire output makes sense. The feature name will be rendered as the
140+
* class name. The long name without the feature will be rendered as the test
141+
* method name. For example:
142+
* {@code Feature Name.Rule Name - Scenario Name - Examples Name - Example #N}.
143143
*/
144144
@API(status = Status.EXPERIMENTAL, since = "7.0.0")
145145
public static final String JUNIT_PLATFORM_NAMING_STRATEGY_PROPERTY_NAME = "cucumber.junit-platform.naming-strategy";

cucumber-junit-platform-engine/src/main/java/io/cucumber/junit/platform/engine/DefaultNamingStrategyProvider.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ NamingStrategy create(ConfigurationParameters configuration) {
3939
NamingStrategy create(ConfigurationParameters configuration) {
4040
return configuration.get(JUNIT_PLATFORM_SUREFIRE_NAMING_STRATEGY_EXAMPLE_NAME_PROPERTY_NAME)
4141
.map(DefaultNamingStrategyProvider::parseStrategy)
42-
.orElse(DefaultNamingStrategyProvider::exampleNumberStrategy)
42+
.orElse(DefaultNamingStrategyProvider::exampleNumberAndPickleIfParameterizedStrategy)
4343
.apply(DefaultNamingStrategyProvider::surefireStrategy);
4444
}
4545
};

cucumber-junit-platform-engine/src/test/java/io/cucumber/junit/platform/engine/FeatureResolverTest.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -221,12 +221,12 @@ void shortNamesWithPickleNamesIfParameterized() {
221221
}
222222

223223
@Test
224-
void surefireNames() {
224+
void surefireNamesWithPickleNamesIfParameterized() {
225225
configurationParameters = new MapConfigurationParameters(
226226
JUNIT_PLATFORM_NAMING_STRATEGY_PROPERTY_NAME, "surefire");
227227

228-
TestDescriptor example = getExample();
229-
assertEquals("A scenario outline - With some text - Example #1.1",
228+
TestDescriptor example = getParametrizedExample();
229+
assertEquals("A scenario with <example> - Examples - Example #1.1: A scenario with A",
230230
example.getDisplayName());
231231

232232
TestDescriptor examples = example.getParent().get();
@@ -235,7 +235,7 @@ void surefireNames() {
235235

236236
TestDescriptor feature = examples.getParent().get();
237237
assertEquals("A feature with scenario outlines",
238-
examples.getDisplayName());
238+
feature.getDisplayName());
239239
}
240240

241241
private TestDescriptor getExample() {

cucumber-junit-platform-engine/src/test/resources/io/cucumber/junit/platform/engine/feature-with-outline.feature

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,3 +48,15 @@ Feature: A feature with scenario outlines
4848
| example |
4949
| A |
5050
| B |
51+
52+
@ScenarioOutlineTag
53+
Scenario Outline: A scenario with <example>
54+
Given a parameterized scenario outline
55+
When it is executed
56+
Then <example> is used
57+
58+
@Example1Tag
59+
Examples:
60+
| example |
61+
| A |
62+
| B |

0 commit comments

Comments
 (0)