File tree 5 files changed +39
-15
lines changed
main/java/io/cucumber/core/runner
test/java/io/cucumber/core/runner
java/src/main/java/io/cucumber/java
java8/src/main/java/io/cucumber/java8
5 files changed +39
-15
lines changed Original file line number Diff line number Diff line change @@ -31,18 +31,20 @@ and this project adheres to [Semantic Versioning](http://semver.org/).
31
31
- Replace ` DataTable.asMaps() ` with -> ` DataTable.entries() `
32
32
* [ TestNG] Automatically pick up properties from ` testng.xml ` ([ #2354 ] ( https://github.com/cucumber/cucumber-jvm/pull/2354 ) M.P. Korstanje, Gayan Sandaruwan)
33
33
* [ Core] Pretty formatter to print step DataTables ([ #2330 ] ( https://github.com/cucumber/cucumber-jvm/pull/2330 ) Arty Sidorenko)
34
+ * [ Core] ` Scenario.getId() ` returns the actual scenario id ([ #2366 ] ( https://github.com/cucumber/cucumber-jvm/issues/2366 ) M.P. Korstanje)
35
+ - To obtain the original ` <uri>:<line-number> ` identifier use ` scenario.getUri() + ":" + scenario.getLine() ` .
34
36
35
37
### Deprecated
36
38
37
39
### Removed
38
40
* [ Core] Removed ` --strict ` and ` --no-strict ` options ([ #1788 ] ( https://github.com/cucumber/cucumber-jvm/issues/1788 ) M.P. Korstanje)
39
- - Cucumber executes scenarios in strict mode by default
41
+ - Cucumber executes scenarios in strict mode by default
40
42
* [ Core] Removed deprecated ` TypeRegistryConfigurer ` ([ #2356 ] ( https://github.com/cucumber/cucumber-jvm/issues/2356 ) M.P. Korstanje)
41
- - Use ` @ParameterType ` instead.
43
+ - Use ` @ParameterType ` instead.
42
44
* [ Weld] Removed ` cucumber-weld ` ([ #2276 ] ( https://github.com/cucumber/cucumber-jvm/issues/2276 ) M.P. Korstanje)
43
- - Consider using ` cucumber-jakarta-cdi ` or ` cucumber-cdi2 ` .
45
+ - Consider using ` cucumber-jakarta-cdi ` or ` cucumber-cdi2 ` .
44
46
* [ Needle] Removed ` cucumber-needled ` ([ #2276 ] ( https://github.com/cucumber/cucumber-jvm/issues/2276 ) M.P. Korstanje)
45
- - Consider using ` cucumber-jakarta-cdi ` or ` cucumber-cdi2 ` .
47
+ - Consider using ` cucumber-jakarta-cdi ` or ` cucumber-cdi2 ` .
46
48
47
49
### Fixed
48
50
* [ Core] Emit step hook messages ([ #2009 ] ( https://github.com/cucumber/cucumber-jvm/issues/2093 ) Grasshopper)
Original file line number Diff line number Diff line change @@ -130,7 +130,7 @@ public String getName() {
130
130
131
131
@ Override
132
132
public String getId () {
133
- return testCase .getUri () + ":" + getLine ();
133
+ return testCase .getId (). toString ();
134
134
}
135
135
136
136
@ Override
Original file line number Diff line number Diff line change 7
7
import io .cucumber .messages .types .Attachment .ContentEncoding ;
8
8
import io .cucumber .messages .types .Envelope ;
9
9
import io .cucumber .plugin .event .EmbedEvent ;
10
- import org .junit .jupiter .api .Assertions ;
11
10
import org .junit .jupiter .api .Test ;
12
11
13
12
import java .io .File ;
14
- import java .nio .charset .StandardCharsets ;
15
13
import java .time .Clock ;
16
14
import java .util .ArrayList ;
17
15
import java .util .Base64 ;
@@ -84,7 +82,7 @@ void provides_the_uri_and_scenario_line_as_unique_id() {
84
82
85
83
TestCaseState state = createTestCaseState (feature );
86
84
87
- assertThat (state .getId (), is (new File ("path/file.feature:2" ).toURI ().toString ()));
85
+ assertThat (state .getUri () + ":" + state . getLine (), is (new File ("path/file.feature:2" ).toURI ().toString ()));
88
86
}
89
87
90
88
@ Test
@@ -98,7 +96,7 @@ void provides_the_uri_and_example_row_line_as_unique_id_for_scenarios_from_scena
98
96
" | cuke | \n " );
99
97
TestCaseState state = createTestCaseState (feature );
100
98
101
- assertThat (state .getId (), is (new File ("path/file.feature:6" ).toURI ().toString ()));
99
+ assertThat (state .getUri () + ":" + state . getLine (), is (new File ("path/file.feature:6" ).toURI ().toString ()));
102
100
}
103
101
104
102
@ Test
Original file line number Diff line number Diff line change @@ -108,6 +108,15 @@ public String getName() {
108
108
}
109
109
110
110
/**
111
+ * Returns the unique identifier for this scenario.
112
+ * <p>
113
+ * If this is a Scenario from Scenario Outlines this will return the id of
114
+ * the example row in the Scenario Outline.
115
+ * <p>
116
+ * The id is not stable across multiple executions of Cucumber but does
117
+ * correlate with ids used in messages output. Use the uri + line number to
118
+ * obtain a somewhat stable identifier of a scenario.
119
+ *
111
120
* @return the id of the Scenario.
112
121
*/
113
122
public String getId () {
@@ -122,9 +131,12 @@ public URI getUri() {
122
131
}
123
132
124
133
/**
125
- * @return the line in the feature file of the Scenario. If this is a
126
- * Scenario from Scenario Outlines this will return the line of the
127
- * example row in the Scenario Outline.
134
+ * Returns the line in the feature file of the Scenario.
135
+ * <p>
136
+ * If this is a Scenario from Scenario Outlines this will return the line of
137
+ * the example row in the Scenario Outline.
138
+ *
139
+ * @return the line in the feature file of the Scenario
128
140
*/
129
141
public Integer getLine () {
130
142
return delegate .getLine ();
Original file line number Diff line number Diff line change @@ -106,6 +106,15 @@ public String getName() {
106
106
}
107
107
108
108
/**
109
+ * Returns the unique identifier for this scenario.
110
+ * <p>
111
+ * If this is a Scenario from Scenario Outlines this will return the id of
112
+ * the example row in the Scenario Outline.
113
+ * <p>
114
+ * The id is not stable across multiple executions of Cucumber but does
115
+ * correlate with ids used in messages output. Use the uri + line number to
116
+ * obtain a somewhat stable identifier of a scenario.
117
+ *
109
118
* @return the id of the Scenario.
110
119
*/
111
120
public String getId () {
@@ -120,9 +129,12 @@ public URI getUri() {
120
129
}
121
130
122
131
/**
123
- * @return the line in the feature file of the Scenario. If this is a
124
- * Scenario from Scenario Outlines this will return the line of the
125
- * example row in the Scenario Outline.
132
+ * Returns the line in the feature file of the Scenario.
133
+ * <p>
134
+ * If this is a Scenario from Scenario Outlines this will return the line of
135
+ * the example row in the Scenario Outline.
136
+ *
137
+ * @return the line in the feature file of the Scenario
126
138
*/
127
139
public Integer getLine () {
128
140
return delegate .getLine ();
You can’t perform that action at this time.
0 commit comments