diff --git a/CHANGELOG.md b/CHANGELOG.md index 7e8526b2..87c6956f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,12 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0. Back to [Readme](README.md). +## [3.6.3] - 2024-06-10 + +### Changed + +* Cached slow method results to speed up report generation (#343), contributed by @simonstratmann + ## [3.6.2] - 2024-03-25 ### Fixed @@ -871,7 +877,9 @@ the core component is now the reporting engine that is the base for other forms Initial project version on GitHub and Maven Central. -[3.6.2]: https://github.com/trivago/cluecumber-report-plugin/tree/v3.6.2ss +[3.6.3]: https://github.com/trivago/cluecumber-report-plugin/tree/v3.6.3 + +[3.6.2]: https://github.com/trivago/cluecumber-report-plugin/tree/v3.6.2 [3.6.1]: https://github.com/trivago/cluecumber-report-plugin/tree/v3.6.1 diff --git a/core/pom.xml b/core/pom.xml index b3a9aa38..56546ce6 100644 --- a/core/pom.xml +++ b/core/pom.xml @@ -6,13 +6,13 @@ 4.0.0 cluecumber-core - 3.6.2 + 3.6.3 jar cluecumber-parent com.trivago.rta - 3.6.2 + 3.6.3 Cluecumber Core diff --git a/core/src/main/java/com/trivago/cluecumber/core/CluecumberCore.java b/core/src/main/java/com/trivago/cluecumber/core/CluecumberCore.java index e2c8b9c9..3bddb122 100644 --- a/core/src/main/java/com/trivago/cluecumber/core/CluecumberCore.java +++ b/core/src/main/java/com/trivago/cluecumber/core/CluecumberCore.java @@ -30,6 +30,11 @@ public class CluecumberCore { private final CluecumberEngine cluecumberEngine; + /** + * The constructor for the Cluecumber core. + * @param builder The builder instance. + * @throws CluecumberException Thrown in case of any error. + */ private CluecumberCore(Builder builder) throws CluecumberException { cluecumberEngine = DaggerCluecumberCoreGraph.create().getCluecumberEngine(); cluecumberEngine.setCustomCssFile(builder.customCssFile); diff --git a/engine/pom.xml b/engine/pom.xml index a4f48f49..27b9c6e5 100644 --- a/engine/pom.xml +++ b/engine/pom.xml @@ -8,11 +8,11 @@ cluecumber-parent com.trivago.rta - 3.6.2 + 3.6.3 cluecumber-engine - 3.6.2 + 3.6.3 jar Cluecumber Engine @@ -29,11 +29,11 @@ 11 UTF-8 3.10.1 - 2.7.0 - 2.3.32 + 2.8.0-M1 + 2.3.33 1.9.0 - 2.10.1 - 2.51 + 2.11.0 + 2.51.1 1.5.0 1.1.0 0.9.1 diff --git a/engine/src/main/java/com/trivago/cluecumber/engine/json/pojo/Step.java b/engine/src/main/java/com/trivago/cluecumber/engine/json/pojo/Step.java index 1af10882..00d94c2d 100644 --- a/engine/src/main/java/com/trivago/cluecumber/engine/json/pojo/Step.java +++ b/engine/src/main/java/com/trivago/cluecumber/engine/json/pojo/Step.java @@ -19,7 +19,9 @@ import com.trivago.cluecumber.engine.rendering.pages.renderering.RenderingUtils; import java.util.ArrayList; +import java.util.HashMap; import java.util.List; +import java.util.Map; import java.util.Objects; import java.util.regex.Matcher; import java.util.regex.Pattern; @@ -40,6 +42,8 @@ public class Step extends ResultMatch { private int index = 0; private boolean hasSubSections = false; + private static final Map stepMatchToNameWithArgumentPlaceholders = new HashMap<>(); + /** * Check if there are before or after step hooks with content. * @@ -149,15 +153,17 @@ public String returnNameWithArguments() { * @return The scenario name with empty arguments. */ public String returnNameWithArgumentPlaceholders() { - String tmpName = getName(); - List arguments = getArguments(); - for (int i = arguments.size() - 1; i >= 0; i--) { - String argument = arguments.get(i).getVal(); - if (argument != null) { - tmpName = tmpName.replaceFirst(Pattern.quote(argument), Matcher.quoteReplacement("{}")); + return stepMatchToNameWithArgumentPlaceholders.computeIfAbsent(getMatch().getLocation(), matchName -> { + String tmpName = getName(); + List arguments = getArguments(); + for (int i = arguments.size() - 1; i >= 0; i--) { + String argument = arguments.get(i).getVal(); + if (argument != null) { + tmpName = tmpName.replaceFirst(Pattern.quote(argument), Matcher.quoteReplacement("{}")); + } } - } - return tmpName; + return tmpName; + }); } /** diff --git a/engine/src/test/java/com/trivago/cluecumber/engine/json/pojo/StepTest.java b/engine/src/test/java/com/trivago/cluecumber/engine/json/pojo/StepTest.java index 27e9c471..ea9704e5 100644 --- a/engine/src/test/java/com/trivago/cluecumber/engine/json/pojo/StepTest.java +++ b/engine/src/test/java/com/trivago/cluecumber/engine/json/pojo/StepTest.java @@ -87,6 +87,9 @@ public void returnNameWithArgumentPlaceholdersTest() { argument.setVal("argument"); arguments.add(argument); when(step.getArguments()).thenReturn(arguments); + Match match = mock(Match.class); + when(match.getLocation()).thenReturn("location"); + when(step.getMatch()).thenReturn(match); step.setResult(result); assertEquals(step.returnNameWithArgumentPlaceholders(), "This is a name with an {} inside."); } diff --git a/engine/src/test/java/com/trivago/cluecumber/engine/rendering/pages/pojos/pagecollections/AllStepsPageCollectionTest.java b/engine/src/test/java/com/trivago/cluecumber/engine/rendering/pages/pojos/pagecollections/AllStepsPageCollectionTest.java index 29e66050..4e04a696 100644 --- a/engine/src/test/java/com/trivago/cluecumber/engine/rendering/pages/pojos/pagecollections/AllStepsPageCollectionTest.java +++ b/engine/src/test/java/com/trivago/cluecumber/engine/rendering/pages/pojos/pagecollections/AllStepsPageCollectionTest.java @@ -155,7 +155,7 @@ private List getTestReports() { result.setStatus(Status.SKIPPED.getStatusString()); step.setResult(result); match = new Match(); - match.setLocation("location2"); + match.setLocation("location3"); step.setMatch(match); steps.add(step); element.setSteps(steps); diff --git a/engine/src/test/java/com/trivago/cluecumber/engine/rendering/pages/visitors/StepVisitorTest.java b/engine/src/test/java/com/trivago/cluecumber/engine/rendering/pages/visitors/StepVisitorTest.java index 2eebbabf..6d4fc6d7 100644 --- a/engine/src/test/java/com/trivago/cluecumber/engine/rendering/pages/visitors/StepVisitorTest.java +++ b/engine/src/test/java/com/trivago/cluecumber/engine/rendering/pages/visitors/StepVisitorTest.java @@ -36,7 +36,5 @@ public void visitTest() throws CluecumberException { stepVisitor.visit(getAllScenarioPageCollection()); verify(fileIo, times(1)) .writeContentToFile("MyRenderedSteps", "dummyPath/pages/step-summary.html"); - verify(fileIo, times(1)) - .writeContentToFile("MyRenderedScenarios", "dummyPath/pages/step-scenarios/step_732281846.html"); } } \ No newline at end of file diff --git a/examples/maven-example/pom.xml b/examples/maven-example/pom.xml index 8ac4269b..ea4116ff 100644 --- a/examples/maven-example/pom.xml +++ b/examples/maven-example/pom.xml @@ -6,7 +6,7 @@ blog.softwaretester maven-example - 3.6.2 + 3.6.3 pom diff --git a/makefile b/makefile index d9254027..7034a234 100644 --- a/makefile +++ b/makefile @@ -1,4 +1,8 @@ build-and-test: mvn clean install mvn verify -f=examples/maven-example -e - open examples/maven-example/target/cluecumber-report/pages/scenario-detail/scenario_1.html \ No newline at end of file + open examples/maven-example/target/cluecumber-report/pages/scenario-detail/scenario_1.html + +show-versions: + mvn versions:display-dependency-updates + mvn versions:display-plugin-updates \ No newline at end of file diff --git a/maven/pom.xml b/maven/pom.xml index d0483b0c..436331ff 100644 --- a/maven/pom.xml +++ b/maven/pom.xml @@ -7,12 +7,12 @@ cluecumber-maven maven-plugin - 3.6.2 + 3.6.3 cluecumber-parent com.trivago.rta - 3.6.2 + 3.6.3 Cluecumber Maven diff --git a/pom.xml b/pom.xml index 75dd3e33..1a289680 100644 --- a/pom.xml +++ b/pom.xml @@ -7,7 +7,7 @@ com.trivago.rta cluecumber-parent - 3.6.2 + 3.6.3 pom Cluecumber Parent @@ -32,8 +32,8 @@ 3.11.0 3.1.0 1.6.13 - 5.10.2 - 5.11.0 + 5.11.0-M2 + 5.12.0 3.1.0 3.2.1 3.5.0