Skip to content

All scenarios created, not just the ones identified by line numbers. #200

@ivanjensen-ep

Description

@ivanjensen-ep

Describe the bug
Previously this was working well for me - a single failed scenario would be re-generated next time and the executed.

A recent upgrade from 1.14.1 to 1.15.1 caused all scenarios in the feature with a failure to be generated

To Reproduce
Steps to reproduce the behavior:

  1. Run cucuable pointing at a "re-run" folder with a file that identifies a specific source scenario.
    filename: /tmp/reruns/rerun1.txt
    Contents:
    file:///path/xyz.feature:4
  2. Run Cucable by passing the rerun folder into the sourceFeatures property -Dparallel.sourceFeatures=@/tmp/reruns/
  3. Cucable generates a runner and feature for each scenario contained in the feature.

Expected behavior
Cucable will generate one runner and one feature as only one scenario was activated in the input.

Attachments
If applicable, add an attachment to help explain your problem.

Additional context
I believe this functionality got lost in a recent change: d83a32b

Based off the old code, I provide the attached patch that seems to fix the issue locally for me.

diff --git a/plugin-code/src/main/java/com/trivago/gherkin/GherkinDocumentParser.java b/plugin-code/src/main/java/com/trivago/gherkin/GherkinDocumentParser.java
index 5936cdc..907d7b1 100644
--- a/plugin-code/src/main/java/com/trivago/gherkin/GherkinDocumentParser.java
+++ b/plugin-code/src/main/java/com/trivago/gherkin/GherkinDocumentParser.java
@@ -150,7 +150,13 @@ public class GherkinDocumentParser {
                         lineNumber = originalScenario.getLocation().getLine().intValue();
                     }
                 }
-                
+
+                if (scenarioLineNumbers != null
+                        && !scenarioLineNumbers.isEmpty()
+                        && !scenarioLineNumbers.contains(lineNumber)) {
+                    continue;
+                }
+
                 // Check if this is a scenario outline (has examples)
                 boolean isScenarioOutline = originalScenario != null && 
                     originalScenario.getExamples() != null && 

only-generate-identified-scenarios.patch

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions