Skip to content

Commit c40c107

Browse files
authored
347 fail on pending (#348)
* added maven wrapper and pending step example * fixed 341
1 parent a76c950 commit c40c107

File tree

16 files changed

+523
-20
lines changed

16 files changed

+523
-20
lines changed

.github/workflows/example-report.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ jobs:
1717
cache: maven
1818
- name: Run example project
1919
working-directory: ./examples/maven-example
20-
run: mvn clean verify
20+
run: ../../mvnw clean verify
2121
- name: Deploy example report
2222
uses: SamKirkland/[email protected]
2323
with:

.github/workflows/release.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ jobs:
3131
gpg-passphrase: MAVEN_GPG_PASSPHRASE
3232

3333
- name: Publish to Apache Maven Central
34-
run: mvn deploy -B -Prelease
34+
run: ./mvnw deploy -B -Prelease
3535
env:
3636
MAVEN_USERNAME: ${{ secrets.OSSRH_USERNAME }}
3737
MAVEN_PASSWORD: ${{ secrets.OSSRH_TOKEN }}

.github/workflows/unit-tests.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -20,4 +20,4 @@ jobs:
2020
distribution: 'temurin'
2121
cache: maven
2222
- name: Test with Maven
23-
run: mvn test
23+
run: ./mvnw test

.mvn/wrapper/maven-wrapper.properties

+19
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
# Licensed to the Apache Software Foundation (ASF) under one
2+
# or more contributor license agreements. See the NOTICE file
3+
# distributed with this work for additional information
4+
# regarding copyright ownership. The ASF licenses this file
5+
# to you under the Apache License, Version 2.0 (the
6+
# "License"); you may not use this file except in compliance
7+
# with the License. You may obtain a copy of the License at
8+
#
9+
# http://www.apache.org/licenses/LICENSE-2.0
10+
#
11+
# Unless required by applicable law or agreed to in writing,
12+
# software distributed under the License is distributed on an
13+
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
14+
# KIND, either express or implied. See the License for the
15+
# specific language governing permissions and limitations
16+
# under the License.
17+
wrapperVersion=3.3.2
18+
distributionType=only-script
19+
distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.9.1/apache-maven-3.9.1-bin.zip

CHANGELOG.md

+7
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,12 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
77

88
Back to [Readme](README.md).
99

10+
## [3.7.1] - 2024-07-12
11+
12+
### Fixed
13+
14+
* `failedScenariosOnPendingOrUndefinedSteps` setting is ignored (#341)
15+
1016
## [3.7.0] - 2024-07-09
1117

1218
### Added
@@ -883,6 +889,7 @@ the core component is now the reporting engine that is the base for other forms
883889

884890
Initial project version on GitHub and Maven Central.
885891

892+
[3.7.1]: https://github.com/trivago/cluecumber-report-plugin/tree/v3.7.1
886893
[3.7.0]: https://github.com/trivago/cluecumber-report-plugin/tree/v3.7.0
887894

888895
[3.6.3]: https://github.com/trivago/cluecumber-report-plugin/tree/v3.6.3

core/pom.xml

+2-2
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,13 @@
66
<modelVersion>4.0.0</modelVersion>
77

88
<artifactId>cluecumber-core</artifactId>
9-
<version>3.7.0</version>
9+
<version>3.7.1</version>
1010
<packaging>jar</packaging>
1111

1212
<parent>
1313
<artifactId>cluecumber-parent</artifactId>
1414
<groupId>com.trivago.rta</groupId>
15-
<version>3.7.0</version>
15+
<version>3.7.1</version>
1616
</parent>
1717

1818
<name>Cluecumber Core</name>

engine/pom.xml

+2-2
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,11 @@
88
<parent>
99
<artifactId>cluecumber-parent</artifactId>
1010
<groupId>com.trivago.rta</groupId>
11-
<version>3.7.0</version>
11+
<version>3.7.1</version>
1212
</parent>
1313

1414
<artifactId>cluecumber-engine</artifactId>
15-
<version>3.7.0</version>
15+
<version>3.7.1</version>
1616
<packaging>jar</packaging>
1717

1818
<name>Cluecumber Engine</name>

engine/src/main/java/com/trivago/cluecumber/engine/json/pojo/Element.java

+2-2
Original file line numberDiff line numberDiff line change
@@ -374,8 +374,8 @@ public Status getStatus() {
374374
if (allStates.isEmpty()) {
375375
return Status.SKIPPED;
376376
}
377-
if (failOnPendingOrUndefined && allStates.size() == 1
378-
&& allStates.iterator().next().basicStatus() == Status.SKIPPED) {
377+
378+
if (failOnPendingOrUndefined && (allStates.contains(Status.PENDING) || allStates.contains(Status.UNDEFINED))) {
379379
return Status.FAILED;
380380
}
381381

engine/src/test/java/com/trivago/cluecumber/engine/json/pojo/ElementTest.java

+18-1
Original file line numberDiff line numberDiff line change
@@ -202,10 +202,27 @@ public void getUndefinedStatusTest() {
202202
element.setSteps(steps);
203203

204204
Status status = element.getStatus();
205-
assertEquals(status, Status.SKIPPED);
205+
assertEquals(Status.SKIPPED, status);
206206
assertTrue(element.isSkipped());
207207
}
208208

209+
@Test
210+
public void getUndefinedStatusWithFailureOnUndefinedSetTest() {
211+
List<Step> steps = new ArrayList<>();
212+
Step step = new Step();
213+
Result result = new Result();
214+
result.setStatus("undefined");
215+
step.setResult(result);
216+
steps.add(step);
217+
element.setSteps(steps);
218+
element.setFailOnPendingOrUndefined(true);
219+
220+
Status status = element.getStatus();
221+
assertEquals(Status.FAILED, status);
222+
assertFalse(element.isSkipped());
223+
assertTrue(element.isFailed());
224+
}
225+
209226
@Test
210227
public void totalDurationTest() {
211228
List<com.trivago.cluecumber.engine.json.pojo.ResultMatch> beforeSteps = new ArrayList<>();
+51
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
[
2+
{
3+
"line": 4,
4+
"elements": [
5+
{
6+
"start_timestamp": "2024-07-12T12:34:37.393Z",
7+
"line": 6,
8+
"name": "Pending step",
9+
"description": "",
10+
"id": "my-feature-with-tags-and-tagged-examples;pending-step",
11+
"type": "scenario",
12+
"keyword": "Scenario",
13+
"steps": [
14+
{
15+
"result": {
16+
"error_message": "io.cucumber.java.PendingException: TODO: implement me\n\tat steps.ExampleSteps.search_for_client(ExampleSteps.java:95)\n\tat ✽.I try to execute a pending step(file:///Users/bbischoff/Development/trivago/cucable-plugin/example-project/target/parallel/features/MyTest10_scenario007_run001_IT.feature:7)\n",
17+
"duration": 2713000,
18+
"status": "pending"
19+
},
20+
"line": 7,
21+
"name": "I try to execute a pending step",
22+
"match": {
23+
"location": "steps.ExampleSteps.search_for_client()"
24+
},
25+
"keyword": "When "
26+
}
27+
],
28+
"tags": [
29+
{
30+
"name": "@us1"
31+
}
32+
]
33+
}
34+
],
35+
"name": "My feature with tags and tagged examples",
36+
"description": "",
37+
"id": "my-feature-with-tags-and-tagged-examples",
38+
"keyword": "Feature",
39+
"uri": "file:target/parallel/features/MyTest10_scenario007_run001_IT.feature",
40+
"tags": [
41+
{
42+
"name": "@us1",
43+
"type": "Tag",
44+
"location": {
45+
"line": 3,
46+
"column": 1
47+
}
48+
}
49+
]
50+
}
51+
]

examples/maven-example/pom.xml

+2-2
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66

77
<groupId>blog.softwaretester</groupId>
88
<artifactId>maven-example</artifactId>
9-
<version>3.7.0</version>
9+
<version>3.7.1</version>
1010
<packaging>pom</packaging>
1111

1212
<properties>
@@ -69,7 +69,7 @@
6969
<!--<customParametersFile>custom/custom.properties</customParametersFile>-->
7070

7171
<!-- Optional: mark scenarios as failed that contain pending or undefined steps (default: false) -->
72-
<!--<failScenariosOnPendingOrUndefinedSteps>true</failScenariosOnPendingOrUndefinedSteps>-->
72+
<!-- <failScenariosOnPendingOrUndefinedSteps>true</failScenariosOnPendingOrUndefinedSteps> -->
7373

7474
<!-- Optional custom CSS for custom styling -->
7575
<!-- <customCss>custom/custom.css</customCss> -->

makefile

+6-5
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
11
build-and-test:
2-
mvn clean install
3-
(cd examples/maven-example && mvn verify -e)
4-
open examples/maven-example/target/cluecumber-report/pages/scenario-detail/scenario_1.html
2+
./mvnw clean install
3+
(cd examples/maven-example && ../../mvnw verify -e)
4+
5+
open examples/maven-example/target/cluecumber-report/index.html
56

67
show-versions:
7-
mvn versions:display-dependency-updates -U -ntp
8-
mvn versions:display-plugin-updates -U -ntp
8+
./mvnw versions:display-dependency-updates -U -ntp
9+
./mvnw versions:display-plugin-updates -U -ntp

maven/pom.xml

+2-2
Original file line numberDiff line numberDiff line change
@@ -7,12 +7,12 @@
77

88
<artifactId>cluecumber-maven</artifactId>
99
<packaging>maven-plugin</packaging>
10-
<version>3.7.0</version>
10+
<version>3.7.1</version>
1111

1212
<parent>
1313
<artifactId>cluecumber-parent</artifactId>
1414
<groupId>com.trivago.rta</groupId>
15-
<version>3.7.0</version>
15+
<version>3.7.1</version>
1616
</parent>
1717

1818
<name>Cluecumber Maven</name>

0 commit comments

Comments
 (0)