Skip to content

Commit

Permalink
347 fail on pending (#348)
Browse files Browse the repository at this point in the history
* added maven wrapper and pending step example

* fixed 341
  • Loading branch information
bischoffdev authored Jul 12, 2024
1 parent a76c950 commit c40c107
Show file tree
Hide file tree
Showing 16 changed files with 523 additions and 20 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/example-report.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ jobs:
cache: maven
- name: Run example project
working-directory: ./examples/maven-example
run: mvn clean verify
run: ../../mvnw clean verify
- name: Deploy example report
uses: SamKirkland/FTP-Deploy-Action@v4.3.5
with:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ jobs:
gpg-passphrase: MAVEN_GPG_PASSPHRASE

- name: Publish to Apache Maven Central
run: mvn deploy -B -Prelease
run: ./mvnw deploy -B -Prelease
env:
MAVEN_USERNAME: ${{ secrets.OSSRH_USERNAME }}
MAVEN_PASSWORD: ${{ secrets.OSSRH_TOKEN }}
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/unit-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,4 +20,4 @@ jobs:
distribution: 'temurin'
cache: maven
- name: Test with Maven
run: mvn test
run: ./mvnw test
19 changes: 19 additions & 0 deletions .mvn/wrapper/maven-wrapper.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.
wrapperVersion=3.3.2
distributionType=only-script
distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.9.1/apache-maven-3.9.1-bin.zip
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,12 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.

Back to [Readme](README.md).

## [3.7.1] - 2024-07-12

### Fixed

* `failedScenariosOnPendingOrUndefinedSteps` setting is ignored (#341)

## [3.7.0] - 2024-07-09

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

Initial project version on GitHub and Maven Central.

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

[3.6.3]: https://github.com/trivago/cluecumber-report-plugin/tree/v3.6.3
Expand Down
4 changes: 2 additions & 2 deletions core/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,13 @@
<modelVersion>4.0.0</modelVersion>

<artifactId>cluecumber-core</artifactId>
<version>3.7.0</version>
<version>3.7.1</version>
<packaging>jar</packaging>

<parent>
<artifactId>cluecumber-parent</artifactId>
<groupId>com.trivago.rta</groupId>
<version>3.7.0</version>
<version>3.7.1</version>
</parent>

<name>Cluecumber Core</name>
Expand Down
4 changes: 2 additions & 2 deletions engine/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,11 @@
<parent>
<artifactId>cluecumber-parent</artifactId>
<groupId>com.trivago.rta</groupId>
<version>3.7.0</version>
<version>3.7.1</version>
</parent>

<artifactId>cluecumber-engine</artifactId>
<version>3.7.0</version>
<version>3.7.1</version>
<packaging>jar</packaging>

<name>Cluecumber Engine</name>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -374,8 +374,8 @@ public Status getStatus() {
if (allStates.isEmpty()) {
return Status.SKIPPED;
}
if (failOnPendingOrUndefined && allStates.size() == 1
&& allStates.iterator().next().basicStatus() == Status.SKIPPED) {

if (failOnPendingOrUndefined && (allStates.contains(Status.PENDING) || allStates.contains(Status.UNDEFINED))) {
return Status.FAILED;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -202,10 +202,27 @@ public void getUndefinedStatusTest() {
element.setSteps(steps);

Status status = element.getStatus();
assertEquals(status, Status.SKIPPED);
assertEquals(Status.SKIPPED, status);
assertTrue(element.isSkipped());
}

@Test
public void getUndefinedStatusWithFailureOnUndefinedSetTest() {
List<Step> steps = new ArrayList<>();
Step step = new Step();
Result result = new Result();
result.setStatus("undefined");
step.setResult(result);
steps.add(step);
element.setSteps(steps);
element.setFailOnPendingOrUndefined(true);

Status status = element.getStatus();
assertEquals(Status.FAILED, status);
assertFalse(element.isSkipped());
assertTrue(element.isFailed());
}

@Test
public void totalDurationTest() {
List<com.trivago.cluecumber.engine.json.pojo.ResultMatch> beforeSteps = new ArrayList<>();
Expand Down
51 changes: 51 additions & 0 deletions examples/maven-example/json/pending.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
[
{
"line": 4,
"elements": [
{
"start_timestamp": "2024-07-12T12:34:37.393Z",
"line": 6,
"name": "Pending step",
"description": "",
"id": "my-feature-with-tags-and-tagged-examples;pending-step",
"type": "scenario",
"keyword": "Scenario",
"steps": [
{
"result": {
"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",
"duration": 2713000,
"status": "pending"
},
"line": 7,
"name": "I try to execute a pending step",
"match": {
"location": "steps.ExampleSteps.search_for_client()"
},
"keyword": "When "
}
],
"tags": [
{
"name": "@us1"
}
]
}
],
"name": "My feature with tags and tagged examples",
"description": "",
"id": "my-feature-with-tags-and-tagged-examples",
"keyword": "Feature",
"uri": "file:target/parallel/features/MyTest10_scenario007_run001_IT.feature",
"tags": [
{
"name": "@us1",
"type": "Tag",
"location": {
"line": 3,
"column": 1
}
}
]
}
]
4 changes: 2 additions & 2 deletions examples/maven-example/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

<groupId>blog.softwaretester</groupId>
<artifactId>maven-example</artifactId>
<version>3.7.0</version>
<version>3.7.1</version>
<packaging>pom</packaging>

<properties>
Expand Down Expand Up @@ -69,7 +69,7 @@
<!--<customParametersFile>custom/custom.properties</customParametersFile>-->

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

<!-- Optional custom CSS for custom styling -->
<!-- <customCss>custom/custom.css</customCss> -->
Expand Down
11 changes: 6 additions & 5 deletions makefile
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
build-and-test:
mvn clean install
(cd examples/maven-example && mvn verify -e)
open examples/maven-example/target/cluecumber-report/pages/scenario-detail/scenario_1.html
./mvnw clean install
(cd examples/maven-example && ../../mvnw verify -e)

open examples/maven-example/target/cluecumber-report/index.html

show-versions:
mvn versions:display-dependency-updates -U -ntp
mvn versions:display-plugin-updates -U -ntp
./mvnw versions:display-dependency-updates -U -ntp
./mvnw versions:display-plugin-updates -U -ntp
4 changes: 2 additions & 2 deletions maven/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,12 @@

<artifactId>cluecumber-maven</artifactId>
<packaging>maven-plugin</packaging>
<version>3.7.0</version>
<version>3.7.1</version>

<parent>
<artifactId>cluecumber-parent</artifactId>
<groupId>com.trivago.rta</groupId>
<version>3.7.0</version>
<version>3.7.1</version>
</parent>

<name>Cluecumber Maven</name>
Expand Down
Loading

0 comments on commit c40c107

Please sign in to comment.