Skip to content

Support the Cucumber-JS 13 built-in junit report format - #66

Open
Noormasarwa wants to merge 5 commits into
masterfrom
noor-defect-3319116
Open

Noormasarwa wants to merge 5 commits into
masterfrom
noor-defect-3319116

Conversation

@Noormasarwa

Copy link
Copy Markdown
Collaborator

Summary

Cucumber-JS 13 replaced the old cucumber-junit report with its built-in junit formatter (--format junit:<file>). bdd2octane now reads this format. It is tested with Cucumber-JS 13.3.0.

Changes

Report conversion

  • CucumberJsHandler, rewritten for the new format:
    • Reads one <testcase> per scenario or Examples row.
    • Finds the feature by name (classname). Finds the scenario from the testcase name: [Rule - ]Scenario[ - Examples - #e.r[: name]].
    • Reads step results from system-out. Undefined, pending and ambiguous steps are reported as failed. Their error message is the failure text, or "The step is " when the failure is empty.
    • A scenario that failed outside its steps, e.g. in a Before/After hook, is reported with skipped steps and a warning. Otherwise it would show as passed in Octane.
  • Examples rows by number:
    • The new BddFrameworkHandler.getOutlineIndex() has a default implementation that returns empty.
    • The new OctaneFeature.findScenario(name, outlineIndex) finds a scenario by row number.
    • Bdd2Octane uses the row number when the handler reports one. A report with only some rows (e.g. a rerun of one row) is then mapped correctly.
    • Other frameworks are unchanged.

Tests

  • New Cucumber-JS 13.3.0 sample features and reports under src/test/resources/cucumber-js/13.3.0/.
  • The 3 Cucumber-JS integration tests (single, multipleDifferent, multipleSame) now use the new reports, with regenerated expected results.
  • TestCucumberJsHandler has 23 tests. They cover statuses, error messages, outlines, rules, hooks, reuse of one handler across testcases, malformed testcases, and a report with a single Examples row.
  • The legacy cucumber-junit fixtures are removed, so the expected file count in FilesLocatorTest changes from 25 to 22.

Documentation

  • README: Cucumber-JS 13.3.0 is the tested version, with notes on the new format and its limitations.

Breaking change

The legacy cucumber-junit report format (Cucumber-JS 7 and earlier) is no longer supported.

Known limitations

  • The report has no step durations, so steps are reported with a duration of 0.
  • Feature names must be unique, because the report has no feature file path.
  • A failed BeforeAll/AfterAll hook is not shown in Octane; it is skipped with a message.

Testing

  • Linux/JDK 8, the same setup CI uses: mvn verify passes 61 unit tests and 38 integration tests.
  • Windows: everything passes except test36 (Cucumber-JVM). It also fails on master on Windows, so it is not caused by this change.
  • The executable JAR and the Maven plugin give the expected output.

Cucumber-JS 13 writes junit reports with its built-in junit formatter:
one <testcase> per scenario or Examples row, with the step results in
system-out. The cucumber-js handler now reads this format. The legacy
cucumber-junit format (one <testsuite> per scenario, Cucumber-JS 7 and
earlier) is no longer supported.

- CucumberJsHandler: rewritten for the new format. It matches features
  by name and scenarios by testcase name (rule, Examples name, row
  number). It reads step statuses from system-out. Undefined, pending
  and ambiguous steps are reported as failed. A scenario that failed
  outside its steps, e.g. in a hook, is reported with skipped steps.
- BddFrameworkHandler.getOutlineIndex() (default: empty),
  OctaneFeature.findScenario(name, outlineIndex), Bdd2Octane: match
  an Examples row by its reported row number. Other handlers are
  unchanged and still match rows in report order.
- Tests: Cucumber-JS 13.3.0 sample features and reports, new expected
  results for the 3 Cucumber-JS integration tests, 23 unit tests in
  TestCucumberJsHandler. The legacy cucumber-junit fixtures are removed.
- README: Cucumber-JS 13.3.0 is the tested version, with notes on the
  new format.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@Noormasarwa Noormasarwa self-assigned this Nov 29, 2026
Noor and others added 4 commits November 30, 2026 12:06
Converting real Cucumber-Ruby 12.0.1 junit reports showed three problems
in the cucumber-ruby handler:

- When the same step appears twice in a scenario, the first one was
  reported as failed, even when the second one failed. The failed step
  is now found by its line in the failure message. If that line is not
  the failed step, e.g. because the feature file changed after the run,
  it is matched by name as before.
- A scenario that failed in a Before or After hook was reported as
  passed. Its steps are now reported as skipped with a warning, as for
  cucumber-js.
- Examples rows were matched in report order, so a report of only some
  rows (e.g. a rerun) assigned results to the wrong rows. Rows are now
  matched by the values in the testcase name. Rows with the same values
  are matched in report order.

Tests: Cucumber-Ruby 12.0.1 sample features and reports, an integration
test with its expected result, and 17 new unit tests in
TestCucumberRubyHandler.

README: Cucumber-Ruby 12.0.1 is the tested version, with notes on the
handler.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

Cucumber-JS 13 writes junit reports with its built-in junit formatter:
one <testcase> per scenario or Examples row, with the step results in
system-out. The cucumber-js handler now reads this format. The legacy
cucumber-junit format (one <testsuite> per scenario, Cucumber-JS 7 and
earlier) is no longer supported.

- CucumberJsHandler: rewritten for the new format. It matches features
  by name and scenarios by testcase name (rule, Examples name, row
  number). It reads step statuses from system-out. Undefined, pending
  and ambiguous steps are reported as failed. A scenario that failed
  outside its steps, e.g. in a hook, is reported with skipped steps.
- BddFrameworkHandler.getOutlineIndex() (default: empty),
  OctaneFeature.findScenario(name, outlineIndex), Bdd2Octane: match
  an Examples row by its reported row number. Other handlers are
  unchanged and still match rows in report order.
- Tests: Cucumber-JS 13.3.0 sample features and reports, new expected
  results for the 3 Cucumber-JS integration tests, 23 unit tests in
  TestCucumberJsHandler. The legacy cucumber-junit fixtures are removed.
- README: Cucumber-JS 13.3.0 is the tested version, with notes on the
  new format.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Converting real Behave 1.3.3 junit reports showed that the
python-behave handler ignored the step results in system-out and lost
hook failures. The handler now:

- Reads the status and duration of each step from the scenario text
  in system-out. Durations are written in nanoseconds, the unit of
  Octane step durations. In a skipped scenario, the steps that passed
  are now reported as passed. Repeated identical steps are told apart
  by their order.
- Reports the failure of a before_scenario or after_scenario hook on
  the first step that did not pass, or on the last step if all of them
  passed, or on the first step if the report has no step results. Such
  scenarios used to be reported as passed. If the scenario has no
  steps, the conversion fails with an error.
- Identifies an Examples row by the "@<examples>.<row>" in its name.
  A report of only some rows, e.g. from behave --no-skipped, is then
  mapped to the right rows.

Tests: Behave 1.3.3 sample features and reports, an integration test
with its expected result, and 15 new unit tests in
TestPythonBehaveHandler. The step statuses and durations in the 3
existing Behave expected files and in one unit test assertion are
updated, verified against their reports.

README: Behave 1.3.3 is the tested version, with notes on the handler.
Converting real Behat 4.1.1 junit reports showed that the php-behat
handler dropped the Examples rows, reported undefined and pending
steps as skipped, and lost hook failures. The handler now:

- Matches an Examples row by its name, which has the values of the
  row, and by its failed step. Rows with the same name are matched in
  report order. The "#<n>" of the name is not used, because Behat
  numbers only the rows that ran, e.g. in a rerun.
- Reports undefined and pending steps as failed, with "undefined: ..."
  and "pending: ..." messages.
- Matches the failed step by its keyword and whole text, rather than by
  any step text that the failure message contains. Repeated steps with
  different keywords are told apart.
- Reports the failure of a hook before the steps (BeforeScenario,
  BeforeFeature) on the first step, and the failure of a hook after the
  steps (AfterScenario, AfterFeature) on the last step. When a step
  also failed, the step failure is reported. If the scenario has no
  steps, the conversion fails with an error.

Tests: Behat 4.1.1 sample features and report, an integration test
with its expected result, and 16 new unit tests in TestPhpBehatHandler.
The 3 existing Behat expected files are unchanged.

README: Behat 4.1.1 is the tested version, with notes on the handler.
Converting real Cucumber-JVM 8.1.0 reports of the junit plugin and of
Maven Surefire 3.6.1 with JUnit 5 and JUnit 4 showed that the
cucumber-jvm handler lost or misreported scenarios:

- Surefire 3.5.3 and later write the runner class as classname, so the
  features were not found (JUnit 5: 0 of 20 scenarios, JUnit 4: 8 of 20).
- Undefined and ambiguous steps in the junit plugin report came out as
  skipped. With JUnit 5, an ambiguous step could come out as passed.
- Examples rows were matched by report order, so reruns and partial runs
  put a failure on the wrong row.
- Feature or Rule names with parentheses crashed the conversion.

The handler now:
- reads the step results that the junit plugin writes to system-out
- finds the feature by the JUnit 5 long name, or by the scenario location
  that the JUnit 4 "pretty" plugin writes to system-out
- reads the undefined and ambiguous steps of JUnit 5 and JUnit 4
- identifies an Examples row by its "#e.r" numbers in the name, or by its
  line in the "pretty" output
- never reports a failed scenario as passed: when no failed step can be
  read (for example, a hook or the test setup failed), all its steps are
  reported as skipped, as before, and a warning is printed

Tests: real 8.1.0 features and reports, 3 integration tests (junit
plugin, Surefire JUnit 5, Surefire JUnit 4) and 17 unit tests. No
existing test was removed or changed, except that FilesLocatorTest now
counts the 2 new expected-result files whose names contain "junit".
README: tested version and handler notes.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.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.

1 participant