Skip to content

feat(cucumber): add JUnit Platform engine support and runner parity (… - #158

Merged
shossain786 merged 1 commit into
seleniumboot:masterfrom
PUSHPAK-JAISWAL:feat/cucumber-junit-platform
Oct 18, 2026
Merged

shossain786 merged 1 commit into
seleniumboot:masterfrom
PUSHPAK-JAISWAL:feat/cucumber-junit-platform

Conversation

@PUSHPAK-JAISWAL

Copy link
Copy Markdown
Contributor

What & why

This PR implements Phase 2 of the Cucumber modernization agreed with @shossain786 in #155.

Following the initial compiler warning cleanups in #157 (PR 1), this PR provides first-class support for executing Cucumber scenarios via cucumber-junit-platform-engine alongside legacy TestNG execution:

  1. Quarantine skip parity across test runners:
    • When running Cucumber on the JUnit Platform, throwing TestNG's SkipException caused scenarios to be marked as FAILED (an unhandled runtime exception) rather than skipped.
    • Added dynamic runner detection in CucumberHooks: throws org.testng.SkipException when executing under TestNG and org.opentest4j.TestAbortedException when running under JUnit Platform.
    • Guarded context inspection with SeleniumBootContext.isInitialized() to handle early hook evaluation safely.
  2. Suite lifecycle parity for JUnit Platform:
    • Enhanced SeleniumBootLauncherListener.testPlanExecutionStarted to mirror SuiteExecutionListener.onStart(): initializes ApiHealthChecker.clearCache(), PreConditionRegistry.loadAll(), and TestManagementReporter.getInstance().onSuiteStart().
    • Added AtomicBoolean suiteStarted guards to both SeleniumBootLauncherListener and TestManagementReporter to ensure suite start hooks are strictly idempotent if both JUnit extension hooks and launcher listeners fire.
  3. Documentation:
    • Updated docs-site/docs/cucumber.md with setup and runner examples for both Option A: JUnit Platform Engine (Recommended) (@Suite, @IncludeEngines("cucumber")) and Option B: TestNG (Legacy / Backwards Compatible).
    • Clarified the deprecation lifecycle of BaseCucumberTest (supported through 3.x, planned for removal in 4.0.0).
  4. Test coverage:
    • Added CucumberQuarantineTest testing TestNG skip behavior, JUnit Platform abort behavior, and an end-to-end launcher execution test verifying 1 aborted scenario with 0 failures.
    • Added unit tests in SeleniumBootLauncherListenerTest covering lifecycle idempotency and state reset across test plans.

Closes #155

Type of change

  • Bug fix
  • New feature (opt-in, aligned with the framework philosophy)
  • Documentation
  • Internal refactor / test coverage

Checklist

  • All existing tests pass (mvn clean verify / mvn test)
  • New behaviour is covered by unit tests
  • No new external dependencies introduced without prior discussion
  • Code follows existing conventions (no new frameworks, minimal abstraction)
  • No breaking changes to @SeleniumBootApi public APIs (or a major version bump is justified below)
  • Docs updated if user-facing behaviour changed (docs-site/)

Notes for reviewers

  • Zero breaking changes: Existing TestNG suites extending BaseCucumberTest continue to run exactly as before with no changes required.
  • Quarantine skip detection: CucumberHooks.isTestNgExecution() inspects org.testng.Reporter.getCurrentTestResult() != null. In unit and launcher engine tests, this cleanly distinguishes between TestNG runs and JUnit Platform runs.

@shossain786
shossain786 merged commit 334daed into seleniumboot:master Oct 18, 2026
2 checks passed
shossain786 added a commit that referenced this pull request Oct 18, 2026
Remove unused variable/imports from the new tests and document the
isTestNgExecution heuristic.

Co-authored-by: Claude Sonnet 5.5 <noreply@anthropic.com>
shossain786 added a commit that referenced this pull request Oct 18, 2026
…ty (#158) (#161)

Co-authored-by: Claude Sonnet 5.5 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: warning in running github actions

2 participants