question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Batching Fails when Scenarios of same Feature are present in different files

See original GitHub issue

Hi Team, If I put Scenarios belonging to the same Feature in separate files, then the batch execution fails. I tested this behaviour for serenity-core from 2.4.24 and 3.1.5 and its the same.

e.g.: Say there are two feature files Sceanrio1.feature and Scenario2.feature.

Scenario1.feature

Feature: Searching for a term

  Scenario: Searching for a term
    Given Sergey is researching things on the internet
    When he looks up "Cucumber"
    Then he should see information about "Cucumber"

Scenario2.feature

Feature: Searching for a term

  Scenario: Searching for a term again
    Given Sergey is researching things on the internet
    When he looks up "Serenity"
    Then he should see information about "Serenity"

when I execute it I get the error as stated in the below details.

gradlew clean test -Pdriver=firefox --info -Dserenity.batch.count=2 -Dserenity.batch.number=1

The error log

starter.CucumberTestSuite STANDARD_OUT
    14:29:44.334 [Test worker] INFO  i.c.junit.CucumberSerenityRunner - Running slice 2 of 2 using fork 1 of 1 from feature paths [file:/C:/Users/M1032630/Downloads/serenity-cucumber-starter-1.0.0/src/test/resources/features/]
    14:29:44.481 [Test worker] ERROR i.c.junit.CucumberSerenityRunner - Test failed to start
    java.lang.IllegalArgumentException: Can't find feature 'Searching for a term #2' in this slice
        at net.serenitybdd.cucumber.suiteslicing.WeightedCucumberScenarios.createFilterContainingScenariosIn(WeightedCucumberScenarios.java:69)
        at io.cucumber.junit.CucumberSerenityRunner.lambda$toPossibleFeatureRunner$5(CucumberSerenityRunner.java:328)
        at java.util.stream.ReferencePipeline$3$1.accept(ReferencePipeline.java:193)
        at java.util.stream.ReferencePipeline$2$1.accept(ReferencePipeline.java:175)
        at java.util.ArrayList$ArrayListSpliterator.forEachRemaining(ArrayList.java:1384)
        at java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:482)

Observe that #⁠2 gets appended to the feature name java.lang.IllegalArgumentException: Can't find feature 'Searching for a term #2' in this slice

However if I put both the scenarios in a single file Scenarios.feature the batching and execution works perfectly fine.

Feature: Searching for a term

  Scenario: Searching for a term
    Given Sergey is researching things on the internet
    When he looks up "Cucumber"
    Then he should see information about "Cucumber"


  Scenario: Searching for a term again
    Given Sergey is researching things on the internet
    When he looks up "Serenity"
    Then he should see information about "Serenity"

For maintainability and reporting purpose, my project maintains each Scenario in a separate .feature file and all Scenarios of the same feature are kept in a directory.

Please suggest to fix this batching issue when maintaining scenarios of same feature in a differnet files.

Issue Analytics

  • State:open
  • Created 2 years ago
  • Comments:5 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
sudarsunperucommented, Jan 17, 2022

Thanks @wakaleo , I will try to look into the Code and Provide a PR. Alternately, I will also look into parallel execution using Cucumber for gradle.

Because of OOM exceptions when running 350+ tests in the same machine, we used batching and executed each batch in a separate node. However I’m not sure if the same is possible using Cucumber parallel execution

0reactions
wakaleocommented, Jan 17, 2022

Why don’t you just run the features in parallel using the Cucumber support for parallel execution?

Read more comments on GitHub >

github_iconTop Results From Across the Web

Common Batch Patterns - Spring
Handling Step Completion When No Input is Found. In many batch scenarios, finding no rows in a database or file to process is...
Read more >
10 Handy Spring Batch Tricks. To Solve Real Life Problems
1. Prevent jobs from running on startup · 2. Initialize the Spring Batch schema · 3. Write a job without a reader or...
Read more >
Guide to Spring Batch Processing | Toptal
Lightweight and with minimal dependencies, Spring Batch is easy to set up and use. This Spring Batch tutorial will walk you through the...
Read more >
Troubleshoot Amazon S3 Batch Operations issues
For example, if your manifest file looks like this (where there are multiple header rows), then Amazon S3 will return an error:.
Read more >
Handling Errors During Batch Job - MuleSoft Documentation
If another step also raises the same error, the runtime logs it again for that step. ... Example. Imagine a batch job that...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found