Skip to content

Commit 05b9682

Browse files
authored
3.10.0 (#365)
* version bump, changelog, dagger update * removed console logs * started refactoring status consolidation * 3.10.0
1 parent 685d101 commit 05b9682

16 files changed

Lines changed: 139 additions & 84 deletions

File tree

CHANGELOG.md

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,28 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
77

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

10+
## [3.10.0] - 2025-01-06
11+
12+
### Added
13+
14+
* Step and scenario results are now cached to speed up report generation
15+
16+
### Fixed
17+
18+
* Unnecessary console logs for dark mode feature (#363)
19+
* Step was reported as passed when a step hook failed (#364)
20+
* Include Hooks in All Steps report to track failures related to Hooks (#364)
21+
* Fixed absolute path to the finished report in the console log
22+
23+
### Changed
24+
25+
* Strict adherence to the official cucumber guidelines for scenario states
26+
* Google Dagger updated to `2.54`
27+
* Freemarker updated to `2.3.33`
28+
* Javadoc updated to `3.11.2`
29+
* JUnit Jupiter updated to `5.11.4`
30+
* Mockito updated to `5.15.2`
31+
1032
## [3.9.0] - 2024-11-05
1133

1234
### Fixed
@@ -940,6 +962,8 @@ the core component is now the reporting engine that is the base for other forms
940962

941963
Initial project version on GitHub and Maven Central.
942964

965+
[3.10.0]: https://github.com/trivago/cluecumber-report-plugin/tree/v3.10.0
966+
943967
[3.9.0]: https://github.com/trivago/cluecumber-report-plugin/tree/v3.9.0
944968

945969
[3.8.2]: https://github.com/trivago/cluecumber-report-plugin/tree/v3.8.2

core/src/main/java/com/trivago/cluecumber/core/CluecumberCore.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -215,9 +215,9 @@ public Builder setCustomStatusColorSkipped(final String customStatusColorSkipped
215215
}
216216

217217
/**
218-
* Whether to expand sub sections or not.
218+
* Whether to expand subsections or not.
219219
*
220-
* @param expandSubSections If true, sub sections will be expanded.
220+
* @param expandSubSections If true, subsections will be expanded.
221221
* @return The {@link Builder}.
222222
*/
223223
public Builder setExpandSubSections(final boolean expandSubSections) {
@@ -237,7 +237,7 @@ public Builder setExpandAttachments(final boolean expandAttachments) {
237237
}
238238

239239
/**
240-
* Whether to expand stepoutputs or not.
240+
* Whether to expand step outputs or not.
241241
*
242242
* @param expandOutputs If true, outputs will be expanded.
243243
* @return The {@link Builder}.
@@ -325,7 +325,7 @@ public Builder setStartPage(final Settings.StartPage startPage) {
325325
}
326326

327327
/**
328-
* Set a custom page tite for the report.
328+
* Set a custom page title for the report.
329329
*
330330
* @param customPageTitle The custom page title.
331331
* @return The {@link Builder}.

engine/pom.xml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,10 +30,10 @@
3030
<maven.compiler.release>11</maven.compiler.release>
3131
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
3232
<tinylog-impl.version>2.8.0-M1</tinylog-impl.version>
33-
<freemarker.version>2.3.33</freemarker.version>
33+
<freemarker.version>2.3.34</freemarker.version>
3434
<gson-fire.version>1.9.0</gson-fire.version>
3535
<gson.version>2.11.0</gson.version>
36-
<dagger.version>2.52</dagger.version>
36+
<dagger.version>2.54</dagger.version>
3737
<property-aggregator.version>1.5.0</property-aggregator.version>
3838
<properties-maven-plugin.version>1.1.0</properties-maven-plugin.version>
3939
<openpojo.version>0.9.1</openpojo.version>

engine/src/main/java/com/trivago/cluecumber/engine/CluecumberEngine.java

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@
3232
import com.trivago.cluecumber.engine.rendering.pages.renderering.RenderingUtils;
3333

3434
import javax.inject.Inject;
35+
import java.io.File;
3536
import java.nio.file.Path;
3637
import java.util.LinkedHashMap;
3738
import java.util.List;
@@ -138,9 +139,11 @@ public void build(
138139
elementMultipleRunsPreProcessor.addMultipleRunsInformationToScenarios(allScenariosPageCollection.getReports());
139140
}
140141
reportGenerator.generateReport(allScenariosPageCollection);
142+
String absoluteReportPath = new File(
143+
propertyManager.getGeneratedHtmlReportDirectory(),
144+
Settings.START_PAGE + Settings.HTML_FILE_EXTENSION).getAbsolutePath();
141145
logger.info(
142-
"=> Cluecumber Report: file:///" + propertyManager.getGeneratedHtmlReportDirectory() + "/" +
143-
Settings.START_PAGE + Settings.HTML_FILE_EXTENSION,
146+
"=> Cluecumber Report: file:///" + absoluteReportPath,
144147
DEFAULT,
145148
COMPACT,
146149
MINIMAL

engine/src/main/java/com/trivago/cluecumber/engine/constants/ChartConfiguration.java

Lines changed: 9 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -23,24 +23,26 @@
2323
import javax.inject.Singleton;
2424

2525
/**
26-
* This stores the colors and type of a report chart.
26+
* This stores the colors and type of report chart.
2727
*/
2828
@Singleton
2929
public class ChartConfiguration {
3030

31-
private final PropertyManager propertyManager;
32-
private String passedColorRgbaString;
33-
private String failedColorRgbaString;
34-
private String skippedColorRgbaString;
31+
private final String passedColorRgbaString;
32+
private final String failedColorRgbaString;
33+
private final String skippedColorRgbaString;
3534

3635
/**
3736
* Constructor for dependency injection.
3837
*
3938
* @param propertyManager The {@link PropertyManager} instance.
4039
*/
4140
@Inject
42-
public ChartConfiguration(final PropertyManager propertyManager) {
43-
this.propertyManager = propertyManager;
41+
public ChartConfiguration(
42+
final PropertyManager propertyManager) {
43+
this.failedColorRgbaString = getRgbaColorStringFromHex(propertyManager.getCustomStatusColorFailed());
44+
this.passedColorRgbaString = getRgbaColorStringFromHex(propertyManager.getCustomStatusColorPassed());
45+
this.skippedColorRgbaString = getRgbaColorStringFromHex(propertyManager.getCustomStatusColorSkipped());
4446
}
4547

4648
/**
@@ -66,9 +68,6 @@ public String getColorRgbaStringByStatus(final Status status) {
6668
* @return The RGBA color.
6769
*/
6870
public String getPassedColorRgbaString() {
69-
if (passedColorRgbaString == null) {
70-
passedColorRgbaString = getRgbaColorStringFromHex(propertyManager.getCustomStatusColorPassed());
71-
}
7271
return passedColorRgbaString;
7372
}
7473

@@ -78,9 +77,6 @@ public String getPassedColorRgbaString() {
7877
* @return The RGBA color.
7978
*/
8079
public String getFailedColorRgbaString() {
81-
if (failedColorRgbaString == null) {
82-
failedColorRgbaString = getRgbaColorStringFromHex(propertyManager.getCustomStatusColorFailed());
83-
}
8480
return failedColorRgbaString;
8581
}
8682

@@ -90,9 +86,6 @@ public String getFailedColorRgbaString() {
9086
* @return The RGBA color.
9187
*/
9288
public String getSkippedColorRgbaString() {
93-
if (skippedColorRgbaString == null) {
94-
skippedColorRgbaString = getRgbaColorStringFromHex(propertyManager.getCustomStatusColorSkipped());
95-
}
9689
return skippedColorRgbaString;
9790
}
9891

engine/src/main/java/com/trivago/cluecumber/engine/constants/Settings.java

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -67,14 +67,6 @@ public Settings() {
6767
* The first part of the name of scenario detail pages.
6868
*/
6969
public static final String SCENARIO_DETAIL_PAGE_FRAGMENT = "/" + SCENARIO_DETAIL_PAGE_PATH + "/scenario_";
70-
/**
71-
* The folder of the scenario rerun pages.
72-
*/
73-
public final static String SCENARIO_RERUN_PAGE_PATH = "scenario-detail";
74-
/**
75-
* The first part of the name of scenario rerun pages.
76-
*/
77-
public static final String SCENARIO_RERUN_PAGE_FRAGMENT = "/" + SCENARIO_RERUN_PAGE_PATH + "/scenario_";
7870
/**
7971
* The name of the tag summary page.
8072
*/

engine/src/main/java/com/trivago/cluecumber/engine/constants/Status.java

Lines changed: 26 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -31,17 +31,14 @@
3131
package com.trivago.cluecumber.engine.constants;
3232

3333
import java.util.Arrays;
34+
import java.util.Iterator;
3435
import java.util.List;
3536
import java.util.Set;
3637

3738
/**
3839
* Enum to manage all states for steps and scenarios.
3940
*/
4041
public enum Status {
41-
/**
42-
* Passed status.
43-
*/
44-
PASSED("passed"),
4542
/**
4643
* Failed status.
4744
*/
@@ -61,7 +58,15 @@ public enum Status {
6158
/**
6259
* Ambiguous status.
6360
*/
64-
AMBIGUOUS("ambiguous");
61+
AMBIGUOUS("ambiguous"),
62+
/**
63+
* Passed status.
64+
*/
65+
PASSED("passed"),
66+
/**
67+
* Ambiguous unused.
68+
*/
69+
UNUSED("unused");
6570

6671
/**
6772
* The three basic states: passed, failed and skipped.
@@ -102,15 +107,30 @@ public Status basicStatus() {
102107

103108
/**
104109
* Return the highest status from the given list of states.
110+
*
105111
* @param allStates The list of states.
106-
* @return The status string.
112+
* @return The highest status.
107113
*/
108114
public static Status getHighestBasicState(Set<Status> allStates) {
109115
return BASIC_STATES.stream().filter(
110116
basicState -> allStates.stream().anyMatch(allState -> allState.basicStatus() == basicState)
111117
).findFirst().orElse(FAILED);
112118
}
113119

120+
/**
121+
* Get the highest state from all states.
122+
*
123+
* @param allStates The list of states.
124+
* @return The highest status.
125+
*/
126+
public static Status getHighestState(Set<Status> allStates) {
127+
return Arrays.stream(values())
128+
.filter(state -> allStates.stream()
129+
.anyMatch(allState -> allState == state))
130+
.findFirst()
131+
.orElse(FAILED);
132+
}
133+
114134
/**
115135
* Return the status string from this enum.
116136
*

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

Lines changed: 17 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,7 @@ public class Element {
5151
private transient int featureIndex = 0;
5252
private transient int scenarioIndex = 0;
5353
private transient boolean failOnPendingOrUndefined = false;
54+
private Status status;
5455

5556
/**
5657
* Default constructor.
@@ -369,22 +370,25 @@ public boolean isSkipped() {
369370
* @return The overall status.
370371
*/
371372
public Status getStatus() {
373+
if (status != null) {
374+
return status;
375+
}
376+
372377
Set<Status> allStates = before.stream().map(ResultMatch::getStatus).collect(Collectors.toSet());
373-
backgroundSteps.stream().map(ResultMatch::getStatus).forEach(allStates::add);
374-
steps.forEach(step -> step.getBefore().forEach(result -> allStates.add(result.getStatus())));
375-
steps.stream().map(ResultMatch::getStatus).forEach(allStates::add);
376-
steps.forEach(step -> step.getAfter().forEach(result -> allStates.add(result.getStatus())));
378+
backgroundSteps.stream().map(Step::getStatus).forEach(allStates::add);
379+
steps.stream().map(Step::getStatus).forEach(allStates::add);
377380
after.stream().map(ResultMatch::getStatus).forEach(allStates::add);
378381

379382
if (allStates.isEmpty()) {
380-
return Status.SKIPPED;
381-
}
382-
383-
if (failOnPendingOrUndefined && (allStates.contains(Status.PENDING) || allStates.contains(Status.UNDEFINED))) {
384-
return Status.FAILED;
383+
status = Status.SKIPPED;
384+
} else if (failOnPendingOrUndefined && (allStates.contains(Status.PENDING) ||
385+
allStates.contains(Status.UNDEFINED))) {
386+
status = Status.FAILED;
387+
} else {
388+
status = Status.getHighestBasicState(allStates);
385389
}
386390

387-
return Status.getHighestBasicState(allStates);
391+
return status;
388392
}
389393

390394
/**
@@ -541,9 +545,9 @@ private int getNumberOfStepsWithStatus(final Status status) {
541545
*/
542546
public long getTotalDuration() {
543547
return before.stream().mapToLong(beforeStep -> beforeStep.getResult().getDuration()).sum() +
544-
backgroundSteps.stream().mapToLong(Step::getTotalDuration).sum() +
545-
steps.stream().mapToLong(Step::getTotalDuration).sum() +
546-
after.stream().mapToLong(afterStep -> afterStep.getResult().getDuration()).sum();
548+
backgroundSteps.stream().mapToLong(Step::getTotalDuration).sum() +
549+
steps.stream().mapToLong(Step::getTotalDuration).sum() +
550+
after.stream().mapToLong(afterStep -> afterStep.getResult().getDuration()).sum();
547551
}
548552

549553
/**

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

Lines changed: 25 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -16,13 +16,10 @@
1616
package com.trivago.cluecumber.engine.json.pojo;
1717

1818
import com.google.gson.annotations.SerializedName;
19+
import com.trivago.cluecumber.engine.constants.Status;
1920
import com.trivago.cluecumber.engine.rendering.pages.renderering.RenderingUtils;
2021

21-
import java.util.ArrayList;
22-
import java.util.HashMap;
23-
import java.util.List;
24-
import java.util.Map;
25-
import java.util.Objects;
22+
import java.util.*;
2623
import java.util.regex.Matcher;
2724
import java.util.regex.Pattern;
2825

@@ -44,6 +41,7 @@ public class Step extends ResultMatch {
4441
private boolean hasSubSections = false;
4542

4643
private static final Map<String, String> stepMatchToNameWithArgumentPlaceholders = new HashMap<>();
44+
private Status status;
4745

4846
/**
4947
* Default constructor.
@@ -52,6 +50,28 @@ public Step() {
5250
// Default constructor
5351
}
5452

53+
/**
54+
* Overwritten getStatus method so that hook statuses are considered as well
55+
*
56+
* @return The highest status of the step and its hooks.
57+
*/
58+
public Status getStatus() {
59+
if (status != null) {
60+
return status;
61+
}
62+
63+
Set<Status> allStatuses = new HashSet<>();
64+
allStatuses.add(super.getStatus());
65+
before.stream()
66+
.map(beforeStep -> Status.fromString(beforeStep.getResult().getStatus()))
67+
.forEach(allStatuses::add);
68+
after.stream()
69+
.map(afterStep -> Status.fromString(afterStep.getResult().getStatus()))
70+
.forEach(allStatuses::add);
71+
status = Status.getHighestState(allStatuses);
72+
return status;
73+
}
74+
5575
/**
5676
* Check if there are before or after step hooks with content.
5777
*

engine/src/main/resources/template/macros/navigation.ftl

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ limitations under the License.
2222

2323
<div class="collapse navbar-collapse" id="navbarSupportedContent">
2424
<ul class="navbar-nav mr-auto">
25+
<#--noinspection FtlReferencesInspection-->
2526
<#list navigationLinks as link>
2627
<li class="nav-item">
2728
<#assign highlightClass="">
@@ -61,7 +62,8 @@ limitations under the License.
6162
</li>
6263
</#list>
6364
</ul>
64-
<button id="dark-light-mode-switch" class="btn btn-secondary btn-sm">Dark Mode</button>
65+
<button id="dark-light-mode-switch" class="btn btn-secondary btn-sm text-sm-center">Dark Mode</button>
66+
<#--noinspection FtlReferencesInspection-->
6567
<span class="text-light">${reportDetails.date}</span>
6668
</div>
6769
</nav>

0 commit comments

Comments
 (0)