Skip to content

Commit

Permalink
344 dont show failures of previous runs in the graphs unless expanded (
Browse files Browse the repository at this point in the history
…#353)

* switched to maven wrapper 4

* aligned hover colors

* wip

* fixed rerun link

* better URL detection

* formatting adjustments, rerun example

* simplified variable names

* further variable name clarification

* removed duplication

* new way of marking multi runs

* individual toggle buttons for multi run children

* todos

* show reruns everywhere, dedicated rerun page

* better formatting of reruns, numbering fix for sequence view

* changed button caption for multirun toggle

* final alignment
  • Loading branch information
bischoffdev authored Sep 6, 2024
1 parent 0909d71 commit 182ae61
Show file tree
Hide file tree
Showing 41 changed files with 719 additions and 234 deletions.
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,5 @@
.classpath
.factorypath
.DS_Store
package-lock.json
package-lock.json
.flattened-pom.xml
2 changes: 1 addition & 1 deletion .mvn/wrapper/maven-wrapper.properties
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,4 @@
# 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
distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/4.0.0-beta-3/apache-maven-4.0.0-beta-3-bin.zip
25 changes: 25 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,28 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.

Back to [Readme](README.md).

## [3.8.0] - 2024-09-06

### Fixed

* Better detection of embedded URLs in attachments, docstrings and outputs
* Fixed table alignment for duration column
* All graphs and totals now show the correct numbers based on the current rerun settings
* Aligned hover colors of overview and detail pages

### Added

* Logged report location now includes `file://` prefix
* Added `Rerun Scenarios` page in case of `groupPreviousScenarioRuns` mode
* Added a dedicated `Reruns` button to each scenario with previous runs

### Changed

* Updated JUnit Jupiter to `5.11.0`
* Updated Mockito to `5.13.0`
* Updated Dagger to `5.52`
* Build and test process uses Maven 4 wrapper

## [3.7.1] - 2024-07-12

### Fixed
Expand Down Expand Up @@ -889,7 +911,10 @@ the core component is now the reporting engine that is the base for other forms

Initial project version on GitHub and Maven Central.

[3.8.0]: https://github.com/trivago/cluecumber-report-plugin/tree/v3.8.0

[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
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ A fully generated example report can be [viewed here](https://softwaretester.blo
Cluecumber generates the following report pages:

* __All Scenarios__: all scenarios grouped by their status `passed`, `failed` or `skipped`.
* __Rerun Scenarios__: all scenarios that had previous runs if the respective option is turned on.
* __Scenario Sequence__: all scenarios in running order including their individual status information
* __Scenario Details__: all steps, hooks, stack traces and attachments of a single scenario
* __All Features__: an overview of all features
Expand All @@ -47,7 +48,7 @@ All changes are documented in the [full changelog](CHANGELOG.md).

## Building

Cluecumber requires Java >= 11 and Maven >= 3.3.9.
Cluecumber requires Java >= 11 and Maven >= 3.6.3.
It is available in [Maven central](https://central.sonatype.com/search?q=g%3Acom.trivago.rta++a%3Acluecumber-core+a%3Acluecumber-maven&smo=true).

## Star History
Expand Down
5 changes: 3 additions & 2 deletions core/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,14 @@
<modelVersion>4.0.0</modelVersion>

<artifactId>cluecumber-core</artifactId>
<version>3.7.1</version>
<version>${revision}</version>
<packaging>jar</packaging>

<parent>
<artifactId>cluecumber-parent</artifactId>
<groupId>com.trivago.rta</groupId>
<version>3.7.1</version>
<version>${revision}</version>
<relativePath>../pom.xml</relativePath>
</parent>

<name>Cluecumber Core</name>
Expand Down
18 changes: 13 additions & 5 deletions engine/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,12 @@
<parent>
<artifactId>cluecumber-parent</artifactId>
<groupId>com.trivago.rta</groupId>
<version>3.7.1</version>
<version>${revision}</version>
<relativePath>../pom.xml</relativePath>
</parent>

<artifactId>cluecumber-engine</artifactId>
<version>3.7.1</version>
<version>${revision}</version>
<packaging>jar</packaging>

<name>Cluecumber Engine</name>
Expand All @@ -28,16 +29,16 @@
<properties>
<maven.compiler.release>11</maven.compiler.release>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<maven-compiler-plugin.version>3.10.1</maven-compiler-plugin.version>
<maven-compiler-plugin.version>3.13.0</maven-compiler-plugin.version>
<tinylog-impl.version>2.8.0-M1</tinylog-impl.version>
<freemarker.version>2.3.33</freemarker.version>
<gson-fire.version>1.9.0</gson-fire.version>
<gson.version>2.11.0</gson.version>
<dagger.version>2.51.1</dagger.version>
<dagger.version>2.52</dagger.version>
<property-aggregator.version>1.5.0</property-aggregator.version>
<properties-maven-plugin.version>1.1.0</properties-maven-plugin.version>
<openpojo.version>0.9.1</openpojo.version>
<maven-jar-plugin.version>3.2.2</maven-jar-plugin.version>
<maven-jar-plugin.version>3.4.2</maven-jar-plugin.version>
</properties>

<dependencies>
Expand Down Expand Up @@ -157,4 +158,11 @@
</plugin>
</plugins>
</build>
<repositories>
<repository>
<id>maven_central</id>
<name>Maven Central</name>
<url>https://repo.maven.apache.org/maven2/</url>
</repository>
</repositories>
</project>
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ public void build(
}
reportGenerator.generateReport(allScenariosPageCollection);
logger.info(
"=> Cluecumber Report: " + propertyManager.getGeneratedHtmlReportDirectory() + "/" +
"=> Cluecumber Report: file:///" + propertyManager.getGeneratedHtmlReportDirectory() + "/" +
Settings.START_PAGE + Settings.HTML_FILE_EXTENSION,
DEFAULT,
COMPACT,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ public class Navigation {
*/
public static final List<Link> internalLinks = Arrays.asList(
new Link("scenario_summary", "pages/scenario-summary.html", LinkType.INTERNAL),
new Link("rerun_scenarios", "pages/rerun-scenarios.html", LinkType.INTERNAL),
new Link("scenario_sequence", "pages/scenario-sequence.html", LinkType.INTERNAL),
new Link("tag_summary", "pages/tag-summary.html", LinkType.INTERNAL),
new Link("step_summary", "pages/step-summary.html", LinkType.INTERNAL),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,14 @@ public class Settings {
* The first part of the name of scenario detail pages.
*/
public static final String SCENARIO_DETAIL_PAGE_FRAGMENT = "/" + SCENARIO_DETAIL_PAGE_PATH + "/scenario_";
/**
* The folder of the scenario rerun pages.
*/
public final static String SCENARIO_RERUN_PAGE_PATH = "scenario-detail";
/**
* The first part of the name of scenario rerun pages.
*/
public static final String SCENARIO_RERUN_PAGE_FRAGMENT = "/" + SCENARIO_RERUN_PAGE_PATH + "/scenario_";
/**
* The name of the tag summary page.
*/
Expand Down Expand Up @@ -100,6 +108,11 @@ public class Settings {
* The name of the tree view page.
*/
public static final String TREE_VIEW_PAGE = "tree-view";
/**
* The name of the tree view page.
*/
public static final String RERUN_SCENARIOS_PAGE = "rerun-scenarios";


/**
* Defines all possible start pages.
Expand Down Expand Up @@ -128,7 +141,11 @@ public enum StartPage {
/**
* The tree view page.
*/
TREE_VIEW(TREE_VIEW_PAGE);
TREE_VIEW(TREE_VIEW_PAGE),
/**
* The rerun scenarios page.
*/
RERUN_SCENARIOS(RERUN_SCENARIOS_PAGE);

private final String pageName;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
import java.util.ArrayList;
import java.util.List;
import java.util.stream.Collectors;
import java.util.stream.Stream;

/**
* Manages access to the file system.
Expand Down Expand Up @@ -60,13 +61,11 @@ public FileSystemManager(final CluecumberLogger logger) {
*/
public List<Path> getJsonFilePaths(final String sourcePath) {
List<Path> jsonFilePaths = new ArrayList<>();
try {
jsonFilePaths =
Files.walk(Paths.get(sourcePath))
.filter(Files::isRegularFile)
.filter(p -> p.toString().toLowerCase().endsWith(".json"))
.collect(Collectors.toList());

try (Stream<Path> paths = Files.walk(Paths.get(sourcePath))) {
jsonFilePaths = paths
.filter(Files::isRegularFile)
.filter(p -> p.toString().toLowerCase().endsWith(".json"))
.collect(Collectors.toList());
} catch (IOException e) {
logger.warn("Unable to traverse JSON files in " + sourcePath);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,24 +32,22 @@
public class Element {
private List<ResultMatch> before = new ArrayList<>();
private int line;
private boolean isLastOfMultipleScenarioRuns = false;
private boolean isNotLastOfMultipleScenarioRuns = false;
private boolean isMultiRunParent = false;
private boolean isMultiRunChild = false;
private String featureName = "";
private String featureUri = "";
private String name = "";
private String description = "";
private String id = "";
private List<ResultMatch> after = new ArrayList<>();
private String type = "";
private String keyword = "";
private final String keyword = "";
private List<Step> backgroundSteps = new ArrayList<>();
private List<Step> steps = new ArrayList<>();
private List<Tag> tags = new ArrayList<>();
@SerializedName("start_timestamp")
private String startTimestamp = "";
private List<Element> childrenElements = new ArrayList<>();
;

private List<Element> multiRunChildren = new ArrayList<>();
private transient int featureIndex = 0;
private transient int scenarioIndex = 0;
private transient boolean failOnPendingOrUndefined = false;
Expand Down Expand Up @@ -535,11 +533,10 @@ private int getNumberOfStepsWithStatus(final Status status) {
* @return the duration in nanoseconds.
*/
public long getTotalDuration() {
long totalDurationNanoseconds = before.stream().mapToLong(beforeStep -> beforeStep.getResult().getDuration()).sum();
totalDurationNanoseconds += backgroundSteps.stream().mapToLong(Step::getTotalDuration).sum();
totalDurationNanoseconds += steps.stream().mapToLong(Step::getTotalDuration).sum();
totalDurationNanoseconds += after.stream().mapToLong(afterStep -> afterStep.getResult().getDuration()).sum();
return totalDurationNanoseconds;
return before.stream().mapToLong(beforeStep -> beforeStep.getResult().getDuration()).sum() +
backgroundSteps.stream().mapToLong(Step::getTotalDuration).sum() +
steps.stream().mapToLong(Step::getTotalDuration).sum() +
after.stream().mapToLong(afterStep -> afterStep.getResult().getDuration()).sum();
}

/**
Expand Down Expand Up @@ -662,9 +659,9 @@ public boolean hasStepHooks() {
}

/**
* Check if this scenario contains sub-sections.
* Check if this scenario contains subsections.
*
* @return true if there are sub-sections.
* @return true if there are subsections.
*/
public boolean hasSubSections() {
for (Step step : backgroundSteps) {
Expand Down Expand Up @@ -789,53 +786,62 @@ public void setId(final String id) {
*
* @return true if this scenario is the last of multiple runs.
*/
public boolean getIsLastOfMultipleScenarioRuns() {
return isLastOfMultipleScenarioRuns;
public boolean isMultiRunParent() {
return isMultiRunParent;
}

/**
* Set to true if this scenario is the last of multiple runs.
*
* @param isLastOfMultipleScenarioRuns true if this scenario is the last of multiple runs.
* @param isMultiRunParent true if this scenario is the last of multiple runs.
*/
public void setIsLastOfMultipleScenarioRuns(final boolean isLastOfMultipleScenarioRuns) {
this.isLastOfMultipleScenarioRuns = isLastOfMultipleScenarioRuns;
public void setMultiRunParent(final boolean isMultiRunParent) {
this.isMultiRunParent = isMultiRunParent;
}

/**
* Check if this scenario was run multiple times and it's not the last run.
*
* @return true if this scenario was run multiple times and it's not the last run.
*/
public boolean getIsNotLastOfMultipleScenarioRuns() {
return isNotLastOfMultipleScenarioRuns;
public boolean isMultiRunChild() {
return isMultiRunChild;
}

/**
* Set to true if this scenario was run multiple times and it's not the last run.
* Set to true if this scenario was run multiple times, but it's not the last run.
*
* @param isNotLastOfMultipleScenarioRuns true if this scenario was run multiple times and it's not the last run.
* @param isMultiRunChild true if this scenario was run multiple times and it's not the last run.
*/
public void setIsNotLastOfMultipleScenarioRuns(final boolean isNotLastOfMultipleScenarioRuns) {
this.isNotLastOfMultipleScenarioRuns = isNotLastOfMultipleScenarioRuns;
public void isMultiRunChild(final boolean isMultiRunChild) {
this.isMultiRunChild = isMultiRunChild;
}

/**
* Get the children elements of this scenario.
*
* @return The children elements.
*/
public List<Element> getChildrenElements() {
return childrenElements;
public List<Element> getMultiRunChildren() {
return multiRunChildren;
}

/**
* Set the children elements of this scenario.
*
* @param childrenElements The children elements.
* @param multiRunChildren The children elements.
*/
public void setMultiRunChildren(final List<Element> multiRunChildren) {
this.multiRunChildren = multiRunChildren;
}

/**
* Check if this scenario is part of a multi-run.
*
* @return true if this scenario is part of a multi-run.
*/
public void setChildrenElements(final List<Element> childrenElements) {
this.childrenElements = childrenElements;
public boolean isPartOfMultiRun() {
return isMultiRunParent || isMultiRunChild;
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@ public class Report implements Cloneable {
private String name = "";
private String description = "";
private String id = "";
private String keyword = "";
private String uri = "";
private List<Tag> tags = new ArrayList<>();

Expand Down
Loading

0 comments on commit 182ae61

Please sign in to comment.