GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — [SUREFIRE-2298] fix xml output with junit 5 nested classes (fix integration with Cucumber and Archunit) by olamy · Pull Request #828 · apache/maven-surefire

Conversation

@olamy

@olamy olamy commented Apr 4, 2025

Copy link
Copy Markdown
Member

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.

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

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

usadamasa, JorgeRdg, BuZZ-dEE, and gaeljw reacted with thumbs up emoji
All reactions
  • 👍 4 reactions
@olamy olamy added the bug Something isn't working label Apr 4, 2025
marcphilipp
marcphilipp reviewed Apr 4, 2025
View reviewed changes
Comment thread surefire-its/src/test/java/org/apache/maven/surefire/its/jiras/Surefire2298IT.java Resolved

Uh oh!

There was an error while loading. Please reload this page.

marcphilipp
marcphilipp reviewed Apr 4, 2025
View reviewed changes
Comment thread ...junit-platform/src/main/java/org/apache/maven/surefire/junitplatform/RunListenerAdapter.java Outdated
Comment on lines +221 to +223
Optional<UniqueId.Segment> classSegment = testIdentifier.getUniqueIdObject().getSegments().stream()
.filter(segment -> "class".equals(segment.getType()))
.findFirst();

@marcphilipp marcphilipp Apr 4, 2025

Copy link
Copy Markdown
Contributor

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

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

olamy reacted with thumbs up emoji
All reactions
  • 👍 1 reaction

@leonard84 leonard84 Apr 7, 2025

Copy link
Copy Markdown

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.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

mpkorstanje reacted with thumbs up emoji
All reactions
  • 👍 1 reaction

@olamy olamy Aug 28, 2025

Copy link
Copy Markdown
Member Author

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

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

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions

@olamy olamy Aug 28, 2025

Copy link
Copy Markdown
Member Author

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 😆

maven-surefire/surefire-providers/surefire-junit-platform/src/main/java/org/apache/maven/surefire/junitplatform/RunListenerAdapter.java

Line 297 in 9f49866

private String[] toClassMethodName(TestIdentifier testIdentifier) {

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@olamy olamy mentioned this pull request Apr 8, 2025
[SUREFIRE-1643] surefire junit5 parallel tests #815
Merged
8 tasks
@hankem hankem mentioned this pull request Apr 9, 2025
ArchTest on fields does not run under Maven Surefire Plugin 3.5.3+ TNG/ArchUnit#1442
Closed
@pzygielo pzygielo mentioned this pull request Apr 16, 2025
With cucumber integration tests not counted in total test summary in surefire-plugin 3.5.3 #834
Closed
@mpkorstanje mpkorstanje mentioned this pull request Apr 24, 2025
Surefire 3.5.3 does not include Cucumber scenarios in test summary count cucumber/cucumber-jvm#2984
Closed
@pzygielo

This comment was marked as outdated.

Sign in to view
@olamy

olamy commented May 18, 2025

Copy link
Copy Markdown
Member Author

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

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@JanMosigItemis

JanMosigItemis commented Jun 18, 2025

Copy link
Copy Markdown

Hello everyone, is there an ETA for this fix?

usadamasa, AccsonautHristo, kmartin88, seeclouis, markuskiss, PaulKlumpp, erwanosouf, imsandli, alexandrepa, jochenwierum-ci, and 4 more reacted with thumbs up emoji Illutax reacted with thumbs down emoji
All reactions
  • 👍 14 reactions
  • 👎 1 reaction

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@jira-importer

jira-importer commented Jul 4, 2025

Copy link
Copy Markdown

Resolve #2601

usadamasa reacted with eyes emoji
All reactions
  • 👀 1 reaction

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@olamy
olamy marked this pull request as draft July 22, 2025 11:14
@olamy

olamy commented Jul 23, 2025

Copy link
Copy Markdown
Member Author

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

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@olamy

olamy commented Jul 23, 2025

Copy link
Copy Markdown
Member Author

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

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@olamy
olamy force-pushed the SUREFIRE-2298-nested-classes branch 2 times, most recently from 2dc3506 to f6c974b Compare July 26, 2025 11:36
@houssain-barouni houssain-barouni mentioned this pull request Jul 29, 2025
Downgrade surefire version to 3.5.2 to allow running ArchUnit tests in the CI camunda/camunda#36115
Merged
1 task
@MarkvanOsch MarkvanOsch mentioned this pull request Aug 1, 2025
Failing Cucumber-Tests are not detected #3166
Closed
@jglick jglick mentioned this pull request Aug 18, 2025
Revert "Bump maven-surefire-plugin.version from 3.5.2 to 3.5.3" jenkinsci/plugin-pom#1184
Merged
olamy added 11 commits August 28, 2025 10:46
@olamy
[SUREFIRE-2298] fix xml output with junit 5 nested classes
603b6ba
Signed-off-by: Olivier Lamy <[email protected]>
@olamy
fix assertions
8c49da9
Signed-off-by: Olivier Lamy <[email protected]>
@olamy
revert changes to try something more simple with next commit
c88a539
Signed-off-by: Olivier Lamy <[email protected]>
@olamy
only activate the StatPerSourceName mode if junit.jupiter.execution.p…
47c1a1b
…arallel is enabled

Signed-off-by: Olivier Lamy <[email protected]>
@olamy
fix typo
9fc2088
Signed-off-by: Olivier Lamy <[email protected]>
@olamy
cannot support both now
1019394
Signed-off-by: Olivier Lamy <[email protected]>
@olamy
naviguate into testPlan hierarchy to find root class for @nested
01342e7
Signed-off-by: Olivier Lamy <[email protected]>
@olamy
reduce number of threads per core
1c9cbea
Signed-off-by: Olivier Lamy <[email protected]>
@olamy
spotless
a4ce840
Signed-off-by: Olivier Lamy <[email protected]>
@olamy
use parent child model for poms
17dfc06
Signed-off-by: Olivier Lamy <[email protected]>
@olamy
restore dynamic
622dda5
Signed-off-by: Olivier Lamy <[email protected]>
@olamy

olamy commented Sep 4, 2025

Copy link
Copy Markdown
Member Author

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

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

olamy added 2 commits September 4, 2025 16:06
@olamy
force compiler plugin version
9a440bc
Signed-off-by: Olivier Lamy <[email protected]>
@olamy
IT need java 17
443a68c
Signed-off-by: Olivier Lamy <[email protected]>
@pzygielo

This comment was marked as resolved.

Sign in to view
@olamy

olamy commented Sep 4, 2025

Copy link
Copy Markdown
Member Author

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 reacted with thumbs up emoji
All reactions
  • 👍 1 reaction

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@pzygielo

This comment was marked as resolved.

Sign in to view
@olamy
olamy merged commit 6c30bf1 into apache:master Sep 4, 2025
@jira-importer jira-importer mentioned this pull request May 18, 2025
[SUREFIRE-2298] @Nested test classes are not reported properly #2601
Closed
@github-actions

github-actions Bot commented Sep 4, 2025

Copy link
Copy Markdown

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

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@github-actions github-actions Bot assigned olamy Sep 4, 2025
@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
mpkorstanje reviewed Sep 5, 2025
View reviewed changes
Comment thread surefire-its/src/test/resources/cucumber-tests/src/test/java/cz/fafejta/RunCucumberTest.java Resolved

Uh oh!

There was an error while loading. Please reload this page.

mpkorstanje added a commit to cucumber/cucumber-jvm that referenced this pull request Sep 6, 2025
@mpkorstanje
Warn when surefire naming strategy is used
57aef42
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
@mpkorstanje mpkorstanje mentioned this pull request Sep 6, 2025
Warn when surefire naming strategy is used cucumber/cucumber-jvm#3067
Merged
8 of 9 tasks
@jesperancinha

jesperancinha commented Sep 11, 2025

Copy link
Copy Markdown

When is the new release coming out? I have a PR open that I want to merge once the release is out: jesperancinha/spring-test-drives#890

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@jesperancinha jesperancinha mentioned this pull request Sep 11, 2025
Bump io.cucumber:cucumber-bom from 7.23.0 to 7.25.0 jesperancinha/spring-test-drives#890
Merged
@slawekjaranowski

slawekjaranowski commented Sep 11, 2025

Copy link
Copy Markdown
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

jesperancinha and gaeljw reacted with thumbs up emoji
All reactions
  • 👍 2 reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@jesperancinha jesperancinha mentioned this pull request Sep 12, 2025
It is not finding the "cucumber" tests. At least that is what it is saying cucumber/cucumber-jvm#3071
Closed
mpkorstanje added a commit to cucumber/cucumber-jvm that referenced this pull request Sep 14, 2025
@mpkorstanje
Warn when surefire naming strategy is used (#3067)
2b78f7e
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
@uhafner uhafner mentioned this pull request Sep 21, 2025
[SUREFIRE-2194] JUnit 5: Implementing tests in test class and nested class results in incorrect reporting #2682
Open
@fabriciorby fabriciorby mentioned this pull request Oct 11, 2025
surefire version 3.5.4 broke maven-surefire-junit5-tree-reporter #3203
Closed
@slawekjaranowski slawekjaranowski mentioned this pull request Feb 17, 2026
Restore reportNameSuffix in testcase classname attribute (regression since 3.5.4) #3265
Closed
@shitikanth shitikanth mentioned this pull request May 20, 2026
[BUG] TXT report shows "Tests run: 0" for outer class when all tests are in @Nested classes #3356
Open
@konstantinos-mylosis konstantinos-mylosis mentioned this pull request Jun 15, 2026
deps: Update plugin.version.failsafe to v3.5.6 (stable/8.7) camunda/camunda#54392
Closed
1 task
@aghoussaini aghoussaini mentioned this pull request Aug 12, 2026
Cucumber scenarios still reported as Tests run: 0 when junit-platform < 1.8 (#828 fix is version-gated) #3428
Closed
@fabriciorby fabriciorby mentioned this pull request Oct 12, 2026
[SUREFIRE-2111] Nested Tests reports are unordered #2855
Closed
This was referenced Nov 1, 2026
Backend build passes when Cucumber scenarios or ArchUnit rules fail (Surefire reports 0 tests) ippontech/iroco2#316
Open
fix: fail the build on Cucumber and ArchUnit test failures ippontech/iroco2-backend#17
Open
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

3 more reviewers
@marcphilipp marcphilipp marcphilipp left review comments
@leonard84 leonard84 leonard84 left review comments
@mpkorstanje mpkorstanje mpkorstanje left review comments
Reviewers whose approvals may not affect merge requirements

Uh oh!

There was an error while loading. Please reload this page.

Assignees

@olamy olamy

Labels

bug Something isn't working

Projects

None yet

Milestone

3.5.4

Development

Successfully merging this pull request may close these issues.

Failsafe not recognizing or recording it executed integration tests [SUREFIRE-2298] @Nested test classes are not reported properly Rerun results incorrectly collated with junit-platform-suite Surefire issue with archunit-tests Issue with custom JUnit 5 Engine and Surefire Reporting
Failing Cucumber-Tests are not detected

Uh oh!

There was an error while loading. Please reload this page.

10 participants

@olamy @pzygielo @JanMosigItemis @jira-importer @ascopes @jesperancinha @slawekjaranowski @marcphilipp @leonard84 @mpkorstanje
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.
You are visitor 01402775 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.