From a0206665a536d1f5886251c787800e54dbc74c85 Mon Sep 17 00:00:00 2001 From: Renato Athaydes Date: Tue, 2 May 2023 23:34:28 +0200 Subject: [PATCH] Fixed iteration title bar to not show iteration values. --- releases/Release_Notes.txt | 3 ++- .../com/athaydes/spockframework/report/util/Utils.groovy | 4 ++-- .../report/internal/SpecIncludingExtraInfoReport.html | 6 +++--- .../report/internal/UnrolledSpecReport.html | 8 ++++---- 4 files changed, 11 insertions(+), 10 deletions(-) diff --git a/releases/Release_Notes.txt b/releases/Release_Notes.txt index f27abd6..c1ae09d 100644 --- a/releases/Release_Notes.txt +++ b/releases/Release_Notes.txt @@ -1,7 +1,8 @@ 2.5.0-groovy-4 - * Fixed how Unrolled feature is determined (changed in Spock 2 to be the default). -* #244 `reportInfo` added to the correct iteration on `@RollUp` test. +* Fixed #244 `reportInfo` added to the correct iteration on `@RollUp` test. +* Fixed feature header to stop showing iteration values, as values as shown in a table already. 2.4.0-groovy-4 - 2022 Oct 30 diff --git a/src/main/groovy/com/athaydes/spockframework/report/util/Utils.groovy b/src/main/groovy/com/athaydes/spockframework/report/util/Utils.groovy index 64d2df7..5b2026f 100644 --- a/src/main/groovy/com/athaydes/spockframework/report/util/Utils.groovy +++ b/src/main/groovy/com/athaydes/spockframework/report/util/Utils.groovy @@ -224,10 +224,10 @@ class Utils { static String featureNameFrom( FeatureInfo feature, IterationInfo iteration, int index ) { if ( feature.iterationNameProvider && iteration.dataValues?.length > 0 ) { - def name = feature.iterationNameProvider.getName( iteration ) + def name = iteration.displayName // reset the index instance to fix #70 - def nameMatcher = name =~ /(.*)\[\d+\]$/ + def nameMatcher = name =~ /(.*)\[.*]$/ if ( nameMatcher.matches() ) { def rawName = nameMatcher.group( 1 ) return "$rawName[$index]" diff --git a/src/test/resources/com/athaydes/spockframework/report/internal/SpecIncludingExtraInfoReport.html b/src/test/resources/com/athaydes/spockframework/report/internal/SpecIncludingExtraInfoReport.html index c0b4b14..918741e 100644 --- a/src/test/resources/com/athaydes/spockframework/report/internal/SpecIncludingExtraInfoReport.html +++ b/src/test/resources/com/athaydes/spockframework/report/internal/SpecIncludingExtraInfoReport.html @@ -217,7 +217,7 @@

Features:

- Unrolled example-based feature adding info [iteration: 0, #0] + Unrolled example-based feature adding info [0] Return
(Unknown)
@@ -281,7 +281,7 @@

Features:

- Unrolled example-based feature adding info [iteration: 1, #1] + Unrolled example-based feature adding info [1] Return
(Unknown)
@@ -345,7 +345,7 @@

Features:

- Unrolled example-based feature adding info [iteration: 2, #2] + Unrolled example-based feature adding info [2] Return
(Unknown)
diff --git a/src/test/resources/com/athaydes/spockframework/report/internal/UnrolledSpecReport.html b/src/test/resources/com/athaydes/spockframework/report/internal/UnrolledSpecReport.html index e0a7e09..b38f761 100644 --- a/src/test/resources/com/athaydes/spockframework/report/internal/UnrolledSpecReport.html +++ b/src/test/resources/com/athaydes/spockframework/report/internal/UnrolledSpecReport.html @@ -67,7 +67,7 @@

Features:

- Example-based feature [a: 2, b: 2, c: 4, #0] + Example-based feature [0] Return
(Unknown)
@@ -120,7 +120,7 @@

Features:

- Example-based feature [a: 1, b: 4, c: 5, #1] + Example-based feature [1] Return
(Unknown)
@@ -173,7 +173,7 @@

Features:

- Second Example-based feature [a: 1, b: 2, c: 3, #0] + Second Example-based feature [0] Return
(Unknown)
@@ -226,7 +226,7 @@

Features:

- Second Example-based feature [a: 5, b: 3, c: 8, #1] + Second Example-based feature [1] Return
(Unknown)