-
Notifications
You must be signed in to change notification settings - Fork 552
[SUREFIRE-2298] fix xml output with junit 5 nested classes (fix integration with Cucumber and Archunit) #828
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
surefire-its/src/test/java/org/apache/maven/surefire/its/jiras/Surefire2298IT.java
Show resolved
Hide resolved
Optional<UniqueId.Segment> classSegment = testIdentifier.getUniqueIdObject().getSegments().stream() | ||
.filter(segment -> "class".equals(segment.getType())) | ||
.findFirst(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You shouldn't parse the UniqueId
because it's considered to be an implementation detail. Instead, you should use testPlan.getParent(testIdentifier)
to find the right level. If this should only support class-based engines, finding the last one with a TestSource
of type ClassSource
should work. If this should also work for file-based engines like Cucumber, you might want to use a differeny heuristic instead. Maybe always use the level immediate below the root (engine descriptor)? If it has a ClassSource
, use that; otherwise, use the display name (similar to what toClassMethodName
does)?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, Cucumber was also broken by the last patch, so the alternative heuristic should be used.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You shouldn't parse the
UniqueId
because it's considered to be an implementation detail. Instead, you should usetestPlan.getParent(testIdentifier)
to find the right level. If this should only support class-based engines, finding the last one with aTestSource
of typeClassSource
should work. If this should also work for file-based engines like Cucumber, you might want to use a differeny heuristic instead. Maybe always use the level immediate below the root (engine descriptor)? If it has aClassSource
, use that; otherwise, use the display name (similar to whattoClassMethodName
does)?
I tried this approach but it looks not possible with the Expected reporting
from here #2601 (comment)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
every single time I see I will have to modify this method I'm just crying 😆
Line 297 in 9f49866
private String[] toClassMethodName(TestIdentifier testIdentifier) { |
This comment was marked as outdated.
This comment was marked as outdated.
yup sorry been busy with other stuff. I'm thinking of possible quick fix which is something more dynamic here https://github.com/apache/maven-surefire/pull/815/files#diff-38e379eb63d7dcd2deb45902b4a494517e4ce54c29913bcf74e7d9243ebb7011R2077 Switching this flag may fix the current issue |
Hello everyone, is there an ETA for this fix? |
Resolve #2601 |
I have actually reverted the change (well make this happening only for parallel execution) |
Sorry for the delay, winter here, so finally back on this. |
2dc3506
to
f6c974b
Compare
Signed-off-by: Olivier Lamy <[email protected]>
Signed-off-by: Olivier Lamy <[email protected]>
Signed-off-by: Olivier Lamy <[email protected]>
…arallel is enabled Signed-off-by: Olivier Lamy <[email protected]>
Signed-off-by: Olivier Lamy <[email protected]>
Signed-off-by: Olivier Lamy <[email protected]>
Signed-off-by: Olivier Lamy <[email protected]>
Signed-off-by: Olivier Lamy <[email protected]>
Signed-off-by: Olivier Lamy <[email protected]>
Signed-off-by: Olivier Lamy <[email protected]>
Signed-off-by: Olivier Lamy <[email protected]>
Signed-off-by: Olivier Lamy <[email protected]>
Oh yeah. we might be finally good now :) |
Signed-off-by: Olivier Lamy <[email protected]>
Signed-off-by: Olivier Lamy <[email protected]>
This comment was marked as resolved.
This comment was marked as resolved.
build output not verified? you sure? |
This comment was marked as resolved.
This comment was marked as resolved.
@olamy The PR can't be associated to a milestone, because there are multiple open milestones. Please add the text "branch: master" to the description to the milestone where this PR belongs to. |
surefire-its/src/test/resources/cucumber-tests/src/test/java/cz/fafejta/RunCucumberTest.java
Show resolved
Hide resolved
With Surefire 3.5.4 the heuristic for naming tests changed[1]. As a result the `surefire` strategy no longer works as expected. But the `long` strategy now does provide reasonable results. On Surefire <= 3.5.2 with the `surefire` strategy the test results would be rendered as: ``` <testcase name="a few cukes" classname="Belly" time="0.062"> ``` On Surefire >= 3.5.4 with the `long` strategy the test results will be rendered as: ``` <testcase name="Belly - a few cukes" classname="RunCucumberTest" time="0.06"> ``` 1. apache/maven-surefire#828
When is the new release coming out? I have a PR open that I want to merge once the release is out: jesperancinha/jeorg-spring-test-drives#890 |
will be soon: https://lists.apache.org/thread/r905v9hrvz34f5t3vzbvnd64fbvpb1no |
With Surefire 3.5.4 the heuristic for naming tests changed[1]. As a result the `surefire` strategy no longer works as expected. But the `long` strategy now does provide reasonable results. On Surefire <= 3.5.2 with the `surefire` strategy the test results would be rendered as: ``` <testcase name="a few cukes" classname="Belly" time="0.062"> ``` This includes both the scenario and feature name. On Surefire >= 3.5.4 with the `surefire` strategy the test results will be rendered as: ``` <testcase name="a few cukes" classname="RunCucumberTest" time="0.06"> ``` This does not include the feature name. On Surefire >= 3.5.4 with the `long` strategy the test results will be rendered as: ``` <testcase name="Belly - a few cukes" classname="RunCucumberTest" time="0.06"> ``` This does the scenario and feature name and also the name of the Suite that ran Cucumber. This is the optimal outcome. 1. apache/maven-surefire#828 Closes: #2984
Signed-off-by: Olivier Lamy [email protected]
Following this checklist to help us incorporate your
contribution quickly and easily:
for the change (usually before you start working on it). Trivial changes like typos do not
require a JIRA issue. Your pull request should address just this issue, without
pulling in other changes.
[SUREFIRE-XXX] - Fixes bug in ApproximateQuantiles
,where you replace
SUREFIRE-XXX
with the appropriate JIRA issue. Best practiceis to use the JIRA issue title in the pull request title and in the first line of the
commit message.
mvn clean install
to make sure basic checks pass. A more thorough check willbe performed on your pull request automatically.
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 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
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
In any other case, please file an Apache Individual Contributor License Agreement.