Repository navigation
Support the Cucumber-JS 13 built-in junit report format - #66
Open
Noormasarwa wants to merge 5 commits into
Open
Noormasarwa wants to merge 5 commits into
Noormasarwa wants to merge 5 commits into
Conversation
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 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>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Cucumber-JS 13 replaced the old
cucumber-junitreport 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:<testcase>per scenario or Examples row.classname). Finds the scenario from the testcase name:[Rule - ]Scenario[ - Examples - #e.r[: name]].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.BddFrameworkHandler.getOutlineIndex()has a default implementation that returns empty.OctaneFeature.findScenario(name, outlineIndex)finds a scenario by row number.Bdd2Octaneuses 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.Tests
src/test/resources/cucumber-js/13.3.0/.TestCucumberJsHandlerhas 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.cucumber-junitfixtures are removed, so the expected file count inFilesLocatorTestchanges from 25 to 22.Documentation
Breaking change
The legacy
cucumber-junitreport format (Cucumber-JS 7 and earlier) is no longer supported.Known limitations
Testing
mvn verifypasses 61 unit tests and 38 integration tests.test36(Cucumber-JVM). It also fails on master on Windows, so it is not caused by this change.