serenity-bdd / serenity-cucumber-starter

A skeleton project for Serenity BDD and Cucumber JVM
Apache License 2.0
178 stars 280 forks source link

'serenity.restart.browser.for.each=feature' don't work when ran using the JUnit Platform Suite Engine #141

Open gorakshasabnis opened 4 months ago

gorakshasabnis commented 4 months ago

What happened?

  1. Create more that 1 feature files having 2 or more scenarios per feature file.

  2. Create cucumber runner as below:

@Suite
@IncludeEngines("cucumber")
@SelectClasspathResource("/features")
@ConfigurationParameter(key = EXECUTION_MODE_FEATURE_PROPERTY_NAME, value = "SAME_THREAD")
@ConfigurationParameter(key = PLUGIN_PROPERTY_NAME,
        value = "io.cucumber.core.plugin.SerenityReporterParallel," +
                "pretty,timeline:target/test-results/timeline")
public class JUnitPlatformSuiteEngineRunner {
}
  1. Add serenity.properties file with below details:
serenity.requirement.types=capability, feature
serenity.project.name=ToDo MVC Automation Report
serenity.restart.browser.for.each=feature
serenity.browser.maximized=true

Actual Result: Running test suite opens new browser for every new scenario irrespective of same or new feature file.

What did you expect to happen?

Expected Result: serenity.restart.browser.for.each=feature shouldn't have restarted the browser for different scenarios under same feature file. Browser should have open & closed per feature file.

This is working perfectly fine with below JUnit 4 runner but not with @Suite:

@RunWith(CucumberWithSerenity.class)
@CucumberOptions(
        plugin = {"pretty"},
        features = "src/test/resources/features"
)
public class JUnit4Runner {
}

Serenity BDD version

4.0.29

JDK version

17

Execution environment

No response

How to reproduce the bug.

Sample project with JUnit4 Runner & JUnit Platfor Suite Runner

gorakshasabnis commented 4 months ago

@wakaleo Can you please help ?

zetadot commented 2 months ago

in think this is related to this issue https://github.com/serenity-bdd/serenity-core/issues/3455