aghoussaini opened a new pull request, #3431: URL: https://github.com/apache/maven-surefire/pull/3431
Backport of #3429 (909444c) from master, adapted for 3.5.x, as requested in https://github.com/apache/maven-surefire/pull/3429#issuecomment-5277757345. Fixes #3428 on the 3.5.x line. `RunListenerAdapter` walked parents through `TestIdentifier.getParentIdObject()`, which only exists from JUnit Platform 1.8. On older launchers the walk no-ops, Cucumber scenarios keep the feature display name as `sourceName`, and `TestSetRunListener` flushes an empty stats bucket for the runner class, so the run reports `Tests run: 0`. Parent resolution now goes through `TestPlan.getParent(TestIdentifier)`, available since Platform 1.0. ### Not a clean cherry-pick `git cherry-pick 909444cba` conflicts in `RunListenerAdapter.java` and `RunListenerAdapterTest.java`, because master has Suite-boundary handling in `findTopParent` (`isEngineIdentifier` / `hasClassSource`) that landed after 3.5.x branched. Resolved by hand: - Only the parent-resolution change is taken. The Suite-boundary logic is not pulled in, and the surrounding 3.5.x logic is left as-is. - Of the three unit tests touched on master, only the new `notifiedWithRunnerClassWhenCucumberScenarioHasNoClassSource` is backported. The two Suite-hierarchy tests it sits next to do not exist on this branch. - `CucumberJUnit4VintageIT` uses JUnit 4 annotations, matching the rest of `surefire-its` on 3.5.x (master has since migrated the ITs to JUnit 5). ### Verification `CucumberJUnit4VintageIT` (cucumber-junit + vintage 5.7.2 + platform 1.7.2) was run both ways on this branch, since the unit test alone cannot reproduce the bug — the unit-test JVM has a modern Platform where `getParentIdObject` is present: - with this change: `Tests run: 1, Failures: 0, Errors: 0` - against unmodified `surefire-3.5.x`: `cucumberScenariosCountedOnPlatform17:56 wrong number of tests expected:<1> but was:<0>` `RunListenerAdapterTest` shows no change in results before and after. --- Following this checklist to help us incorporate your contribution quickly and easily: - [x] Each commit in the pull request should have a meaningful subject line and body. - [x] Write a pull request description that is detailed enough to understand what the pull request does, how, and why. - [ ] Run `mvn clean install` to make sure basic checks pass. A more thorough check will be performed on your pull request automatically. - [ ] You have run the integration tests successfully (`mvn -Prun-its clean install`). If your pull request is about ~20 lines of code you don't need to sign an [Individual Contributor License Agreement](https://www.apache.org/licenses/icla.pdf) if you are unsure please ask on the developers list. To make clear that you license your contribution under the [Apache License Version 2.0, January 2004](http://www.apache.org/licenses/LICENSE-2.0) you have to acknowledge this by using the following check-box. - [ ] I hereby declare this contribution to be licenced under the [Apache License Version 2.0, January 2004](http://www.apache.org/licenses/LICENSE-2.0) - [ ] In any other case, please file an [Apache Individual Contributor License Agreement](https://www.apache.org/licenses/icla.pdf). -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
