Skip to content

Add a Cucumber JVM 8 adapter - #1455

Open
MohabMohie wants to merge 2 commits into
allure-framework:mainfrom
MohabMohie:cucumber-8-adapter
Open

MohabMohie wants to merge 2 commits into
allure-framework:mainfrom
MohabMohie:cucumber-8-adapter

Conversation

@MohabMohie

Copy link
Copy Markdown

What

Adds allure-cucumber8-jvm, a Cucumber JVM 8 plugin that mirrors allure-cucumber7-jvm and runs on Cucumber 8.0.4.

Cucumber 8 messages type Location.line as a Java int. This module stores lines in Map<Integer, AstNode> and calls int getLine(). Bytecode compiled against the cucumber 7 Long getLine() descriptor throws NoSuchMethodError on this runtime.

Cucumber 8 reports a failed @BeforeAll or @AfterAll hook on the TestRunHookFinished message. TestRunFinished has no throwable for that hook, and Runtime.run() returns. The adapter writes the same run-level global error the cucumber 7 adapter writes when the plugin result carries the throwable.

The suite also records @flaky, @muted, and @known on the scenario result.

Coverage

A real Cucumber JVM 8.0.4 run asserts feature source through the title path and descriptions, scenario name, uri:line full name, example-row parameters, step keyword and text with status, data-table CSV attachment, before/after hooks as fixtures, other hooks as steps, write and embed attachments, tag labels, issue and TMS links, flaky/muted/known, undefined step text Undefined Step. Please add step definition, pending, ambiguous, and a run-level global error when @BeforeAll fails before any scenario.

Tracker

Requested by #1451. This pull request does not close that issue.

The adapter mirrors allure-cucumber7-jvm and reads Gherkin lines as ints from messages v34. Cucumber 8 reports failed @BeforeAll and @afterall hooks on TestRunHookFinished, so those failures are stored as run-level global errors. Status tags mark flaky, muted, and known results.
The install command compiles allure-cucumber8-jvm against Allure Java 3.0.0 and skips signing so a commit build can be resolved before the upstream release.
@CLAassistant

CLAassistant commented Oct 12, 2026 •

Copy link
Copy Markdown

CLA assistant check
All committers have signed the CLA.

MohabMohie added a commit to ShaftHQ/SHAFT_ENGINE that referenced this pull request Oct 12, 2026
Fixes #6262

SHAFT now runs Cucumber 8.0.4 and reports through
`io.qameta.allure.cucumber8jvm.AllureCucumber8Jvm`. The adapter sources
are the Cucumber 8 port from
allure-framework/allure-java#1455 at commit
`a1df39fffb1389ecbce951d617b5da3c49bb1a3a`, compiled into
`shaft-engine`. Listeners extend that class. The published
`shaft-engine` jar carries the classes, so consumers resolve
shaft-engine from Maven Central and do not need another repository.

A JitPack repository is not used. JitPack also serves
`com.github.docker-java:docker-java:3.7.1`, and that POM depends on
`com.github.docker-java.docker-java` transports, including the test-kit
that brings `junit:junit:4.12`.

SHAFT still depends on `cucumber-java`, `cucumber-testng`, and
`cucumber-picocontainer` directly, so the cucumber-bom 8.0.4 import
supplies them. `CucumberFeatureListener` and
`CucumberTestRunnerListener` extend `AllureCucumber8Jvm`. The JSON
cucumber plugin path stays `json:allure-results/cucumber.json`.
Dependabot no longer ignores `io.cucumber:cucumber-bom` semver-major
updates.

Upstream request remains
allure-framework/allure-java#1451. This pull
request does not close that issue.

## Riskiest assumption

The adapter sources compiled into `shaft-engine` are the Cucumber 8
listener from allure-java commit
`a1df39fffb1389ecbce951d617b5da3c49bb1a3a`.
`CucumberFeatureListenerUnitTest` asserts that `AllureCucumber8Jvm`
loads from `shaft-engine`, and
`CucumberTestsHelperCoverageUnitTest.configureCucumberPropertiesShouldPopulateAllExpectedParameters`
still sees `json:allure-results/cucumber.json`.

## Evidence

- Focused shaft-engine tests passed after the adapter moved in-tree:
Tests run: 15, Failures: 0, Errors: 0.
- The overlay test still reads the scenario name and last-step health
through the shipped listener.
- The TestNG Cucumber runner listener tests still pass.
- The shipped cucumber plugin string still contains
`json:allure-results/cucumber.json`.
@MohabMohie

Copy link
Copy Markdown
Author

@baev appreciate your review and feedback :)

@MohabMohie

Copy link
Copy Markdown
Author

@andrcuns appreciate your feedback if applicable

Comment thread jitpack.yml

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

remove

@baev baev left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thanks. Please remove the jitpack.yml

)
)
.orElse("failed");
writeRunLevelError(new IllegalStateException(detail));

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please preserve the original exception details when reporting failed @BeforeAll / @AfterAll hooks. This already works in the JVM 7 adapter: it passes result.getError() to createGlobalError. I verified both hook cases with Cucumber 7.34.8, and the generated traces retain the original RuntimeException and the failing hook frame (BrokenBeforeAllHooks.java:27 / BrokenAfterAllHooks.java:27).

Here, new IllegalStateException(detail) replaces the original exception type, stack trace and causes with a new trace pointing into the adapter at this line. The current JVM 8 test output confirms that the failing hook frame is lost.

finished.getResult().getException() already provides the original type and stack trace. Please preserve those in the GlobalError and extend the hook tests to assert the original failing hook frame, keeping the existing JVM 7 reporting behavior.

@anilreddy

Copy link
Copy Markdown

@MohabMohie can you please complete the changes we need this to be merged... waiting for it..

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.

4 participants