GeezerVisonThe World Wide Web, restored to 800 pixels of glory. | |||||||||||||||||||||||||
| Home|About|Gaming cabinet|Archives|How it works|Starter sites | |||||||||||||||||||||||||
GeezerVison is showing github.com — Fixes #3264 : tests inside @Suite incorrectly classified as flakes by mirkoalicastro · Pull Request #3342 · apache/maven-surefire Conversation
|
|
Hi @olamy , any chance you could have a look at this? 🙏 |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
@olamy it looks that there are some failures - unrelated to the changes. Would it be fine to proceed? |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
I have the same failure locally using Output |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
Thanks @olamy. I guess I initially ran the IT with older version than 17. I fixed it and add a unit test for it. |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
@olamy , any chance you could check now that the pipeline is green? |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
This PR fixes incorrect test attribution when rerunFailingTestsCount is used with JUnit Platform @Suite, where tests from different classes could be merged under the Suite class name (leading to real failures being misclassified as flakes). The change updates RunListenerAdapter.findTopParent() to stop traversal at nested engine boundaries inside Suites so the reported source class remains the real test class (while still falling back to the Suite class for engines that don’t expose class-level sources, e.g., Cucumber).
Changes:
RunListenerAdapter.findTopParent() to stop at nested engine boundaries inside a Suite when a ClassSource is present.ClassSource) hierarchies.Copilot reviewed 3 out of 3 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| surefire-providers/surefire-junit-platform/src/main/java/org/apache/maven/surefire/junitplatform/RunListenerAdapter.java | Adjusts top-parent detection to avoid attributing nested-engine tests to the enclosing Suite class when a real test class is available. |
| surefire-providers/surefire-junit-platform/src/test/java/org/apache/maven/surefire/junitplatform/RunListenerAdapterTest.java | Adds unit tests covering Suite-with-nested-engine attribution for both Jupiter-style and Cucumber-style hierarchies. |
| surefire-its/src/test/java/org/apache/maven/surefire/its/jiras/Surefire1787JUnit45IT.java | Updates the expected Surefire XML report filename/classname attribution for the JUnit 5 Suite integration scenario. |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
| if (lastOpen >= 0) { | ||
| int colon = uniqueId.indexOf(':', lastOpen); | ||
| if (colon > lastOpen) { | ||
| return "engine".equals(uniqueId.substring(lastOpen + 1, colon)); |
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
Is there anything less brittle than relying on this?
@sormuras any idea how to identify a node being the engine?
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
Mh, there's no direct API like UniqueId::isEngine in https://docs.junit.org/6.1.2/api/org.junit.platform.engine/org/junit/platform/engine/UniqueId.html ... 🤔
@marcphilipp Any idea?
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
Does this help?
testIdentifier.getUniqueIdObject().getLastSegment().isEngine()
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
That should do it
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
However, that API was introduced in 6.1.1. You can check for "engine".equals(segment.getType()), though, in earlier versions.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
Successfully merging this pull request may close these issues.
There was an error while loading. Please reload this page.