Skip to content

Introduce experimental memory cleanup mode#5588

Draft
marcphilipp wants to merge 7 commits intomainfrom
marc/test-plan-memory-optimization
Draft

Introduce experimental memory cleanup mode#5588
marcphilipp wants to merge 7 commits intomainfrom
marc/test-plan-memory-optimization

Conversation

@marcphilipp
Copy link
Copy Markdown
Member

Issue: #5344

@mpkorstanje
Copy link
Copy Markdown
Contributor

mpkorstanje commented Apr 7, 2026

    public static void main(String[] args) {
        SummaryGeneratingListener listener = new SummaryGeneratingListener();
        LauncherFactory.create()
                .execute(LauncherDiscoveryRequestBuilder.discoveryRequest()
                        .selectors(DiscoverySelectors.selectClass(RunCucumberTest.class))
                        .build(), listener);

        listener.getSummary()
                .printFailuresTo(new PrintWriter(System.out));
    }
Exception in thread "main" org.junit.platform.commons.PreconditionViolationException: No TestIdentifier with unique ID [[engine:junit-platform-suite]/[suite:com.example.project.RunCucumberTest]/[engine:cucumber]/[feature:classpath%3Acom%2Fexample%2Fproject%2Fbelly.feature]] has been added to this TestPlan.
	at org.junit.platform.commons.util.Preconditions.condition(Preconditions.java:389)
	at org.junit.platform.commons.util.Preconditions.notNull(Preconditions.java:74)
	at org.junit.platform.launcher.TestPlan.getTestIdentifier(TestPlan.java:212)
	at java.base/java.util.Optional.map(Optional.java:260)
	at org.junit.platform.launcher.TestPlan.getParent(TestPlan.java:155)
	at org.junit.platform.launcher.listeners.MutableTestExecutionSummary.collectTestDescription(MutableTestExecutionSummary.java:229)
	at org.junit.platform.launcher.listeners.MutableTestExecutionSummary.describeTest(MutableTestExecutionSummary.java:223)
	at org.junit.platform.launcher.listeners.MutableTestExecutionSummary.lambda$printFailuresTo$0(MutableTestExecutionSummary.java:207)
	at java.base/java.util.ArrayList.forEach(ArrayList.java:1604)
	at java.base/java.util.Collections$SynchronizedCollection.forEach(Collections.java:2361)
	at org.junit.platform.launcher.listeners.MutableTestExecutionSummary.printFailuresTo(MutableTestExecutionSummary.java:206)
	at org.junit.platform.launcher.listeners.MutableTestExecutionSummary.printFailuresTo(MutableTestExecutionSummary.java:196)
	at com.example.project.RunCucumberTest.main(RunCucumberTest.java:36)

edit: Likewise

    public static void main(String[] args) throws IOException {
        ConsoleLauncher.main("execute", "--select-package", "com.example.project");
    }

But at least the tree summary works. 😄

╷
├─ Cucumber ✔
│  └─ Belly ✔
│     └─ a few cukes ✘ T
└─ JUnit Platform Suite ✔
   └─ RunCucumberTest ✔
      └─ Cucumber ✔
         └─ Belly ✔
            └─ a few cukes ✘ T

Failures (2):
No TestIdentifier with unique ID [[engine:cucumber]/[feature:classpath%3Acom%2Fexample%2Fproject%2Fbelly.feature]] has been added to this TestPlan.

@marcphilipp
Copy link
Copy Markdown
Member Author

@mpkorstanje I pushed 48f77bb to fix the exception reported above.


private final TestPlan testPlan;
private final List<Failure> failures = synchronizedList(new ArrayList<>());
private final Map<UniqueId, String> descriptions = new ConcurrentHashMap<>();
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The description could be made part of the DefaultFailure.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I didn't want to break serialization compatiblity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants