Testing / Cucumber Interview Questions
How do you configure the Cucumber JUnit 5 Platform Suite runner?
Configuring the JUnit 5 Platform Suite for Cucumber-JVM involves a small set of annotations on an otherwise-empty class, plus configuration parameters controlling glue location, formatters, and filtering.
import org.junit.platform.suite.api.*; @Suite @IncludeEngines("cucumber") @SelectClasspathResource("features") @ConfigurationParameter(key = "cucumber.glue", value = "com.example.steps,com.example.hooks") @ConfigurationParameter(key = "cucumber.plugin", value = "pretty, html:target/cucumber-report.html") @ConfigurationParameter(key = "cucumber.filter.tags", value = "@regression and not @wip") public class RunCucumberTest { }
@IncludeEngines("cucumber") tells the JUnit Platform to use Cucumber's test engine for discovery. @SelectClasspathResource points at where feature files live. The cucumber.glue parameter can list multiple comma-separated packages, which is common when step definitions and hooks are organized into separate packages rather than one flat one. cucumber.filter.tags applies a tag expression at the runner level, so the same suite naturally supports being run with different tag filters (locally versus in CI) simply by overriding that one configuration parameter, without touching any feature files or step definitions.
More Related questions...