Skip to content

Conversation

olamy
Copy link
Member

@olamy olamy commented Apr 4, 2025

Signed-off-by: Olivier Lamy [email protected]

Following this checklist to help us incorporate your
contribution quickly and easily:

  • Make sure there is a JIRA issue filed
    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.
  • Each commit in the pull request should have a meaningful subject line and body.
  • Format the pull request title like [SUREFIRE-XXX] - Fixes bug in ApproximateQuantiles,
    where you replace SUREFIRE-XXX with the appropriate JIRA issue. Best practice
    is to use the JIRA issue title in the pull request title and in the first line of the
    commit message.
  • 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 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.

@olamy olamy added the bug Something isn't working label Apr 4, 2025
Comment on lines 221 to 223
Optional<UniqueId.Segment> classSegment = testIdentifier.getUniqueIdObject().getSegments().stream()
.filter(segment -> "class".equals(segment.getType()))
.findFirst();
Copy link
Contributor

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)?

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.

Copy link
Member Author

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)?

I tried this approach but it looks not possible with the Expected reporting from here #2601 (comment)

Copy link
Member Author

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 😆

@pzygielo

This comment was marked as outdated.

@olamy
Copy link
Member Author

olamy commented May 18, 2025

Hi @olamy

you might be able to see progress there #828

But... is there any?

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

@JanMosigItemis
Copy link

Hello everyone, is there an ETA for this fix?

@jira-importer
Copy link

Resolve #2601

@olamy olamy marked this pull request as draft July 22, 2025 11:14
@olamy
Copy link
Member Author

olamy commented Jul 23, 2025

I have actually reverted the change (well make this happening only for parallel execution)
But even if test number is fine but even with 3.5.2 or even now, generated XML files are/were not correct (there are 3 instead of 2 with the added test with this PR).

@olamy
Copy link
Member Author

olamy commented Jul 23, 2025

Sorry for the delay, winter here, so finally back on this.
Some progress. Last changes should have fixed the problem, but I need to check what else I just broke :)

Signed-off-by: Olivier Lamy <[email protected]>
@olamy
Copy link
Member Author

olamy commented Sep 4, 2025

Oh yeah. we might be finally good now :)
it took a while but finally managed to work on this.
Sorry for delay

Signed-off-by: Olivier Lamy <[email protected]>
Signed-off-by: Olivier Lamy <[email protected]>
@pzygielo

This comment was marked as resolved.

@olamy
Copy link
Member Author

olamy commented Sep 4, 2025

The faulty m-sf-p ran cucumber tests fine, but didn't produce expected summary.

I see cucumber test was added, but I can't see its build output to be verified for expected result. Does the new test fail without other changes in this PR? Or would it pass then (with 3.9.3) just like now (hence not providing new check)?

build output not verified? you sure?

https://github.com/apache/maven-surefire/pull/828/files#diff-b64af33c9a98c2d43c52cfca7f3bb89af9a833feae8489c0738560350c4592caR55

@pzygielo

This comment was marked as resolved.

@olamy olamy merged commit 6c30bf1 into apache:master Sep 4, 2025
86 of 88 checks passed
Copy link

github-actions bot commented Sep 4, 2025

@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.

@olamy olamy added this to the 3.5.4 milestone Sep 4, 2025
@olamy olamy deleted the SUREFIRE-2298-nested-classes branch September 4, 2025 22:59
@olamy olamy changed the title [SUREFIRE-2298] fix xml output with junit 5 nested classes [SUREFIRE-2298] fix xml output with junit 5 nested classes (fix integration with Cucumber and Archunit) Sep 4, 2025
mpkorstanje added a commit to cucumber/cucumber-jvm that referenced this pull request Sep 6, 2025
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
@jesperancinha
Copy link

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

@slawekjaranowski
Copy link
Member

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

mpkorstanje added a commit to cucumber/cucumber-jvm that referenced this pull request Sep 14, 2025
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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
10 participants