eclipse-jdt / eclipse-jdt/eclipse.jdt.ui
Unable to access old tests in test history if display name contains special character
- Dominant language
- Java
- Stars
- 59
- Forks
- 127
- Avg merge
- 23h 30m
- Merged PRs (30d)
- 35
Description
Trying to access an old test session (suite?) from the test history menu, when it contains a test with a display name containing a special character, fails with a blank list of tests.
In the error log it can be found an error with this message
```
The test run could not be imported from file 'C:\Dev\eclipse-workspace\.metadata\.plugins\org.eclipse.jdt.junit.core\history\20241107-105925.384.xml'.
```
and this stack trace:
```
org.eclipse.core.runtime.CoreException: Launch configuration TestWithSpecialChars references non-existing project my.examples.
at org.eclipse.jdt.launching.JavaRuntime.abort(JavaRuntime.java:1858)
at org.eclipse.jdt.launching.JavaRuntime.getJavaProject(JavaRuntime.java:1735)
at org.eclipse.m2e.jdt.internal.launch.MavenLaunchConfigurationListener.updateLaunchConfiguration(MavenLaunchConfigurationListener.java:64)
at org.eclipse.m2e.jdt.internal.launch.MavenLaunchConfigurationListener.launchConfigurationChanged(MavenLaunchConfigurationListener.java:50)
at org.eclipse.debug.internal.core.LaunchManager$ConfigurationNotifier.run(LaunchManager.java:220)
at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:47)
at org.eclipse.debug.internal.core.LaunchManager$ConfigurationNotifier.notify(LaunchManager.java:204)
at org.eclipse.debug.internal.core.LaunchManager.launchConfigurationChanged(LaunchManager.java:2010)
at org.eclipse.debug.internal.core.LaunchConfigurationWorkingCopy.writeNewFile(LaunchConfigurationWorkingCopy.java:380)
at org.eclipse.debug.internal.core.LaunchConfigurationWorkingCopy.doSave0(LaunchConfigurationWorkingCopy.java:259)
at org.eclipse.debug.internal.core.LaunchConfigurationWorkingCopy.doSave(LaunchConfigurationWorkingCopy.java:229)
at org.eclipse.debug.internal.core.LaunchConfigurationWorkingCopy.doSave(LaunchConfigurationWorkingCopy.java:187)
at org.eclipse.m2e.jdt.internal.launch.MavenRuntimeClasspathProvider.enable(MavenRuntimeClasspathProvider.java:398)
at org.eclipse.m2e.jdt.internal.launch.MavenRuntimeClasspathProvider.enable(MavenRuntimeClasspathProvider.java:427)
at org.eclipse.m2e.jdt.internal.launch.MavenLaunchConfigurationListener.mavenProjectChanged(MavenLaunchConfigurationListener.java:132)
at org.eclipse.m2e.core.internal.project.registry.ProjectRegistryManager.notifyProjectChangeListeners(ProjectRegistryManager.java:888)
at org.eclipse.m2e.core.internal.project.registry.ProjectRegistryManager.applyMutableProjectRegistry(ProjectRegistryManager.java:1040)
at org.eclipse.m2e.core.internal.project.registry.ProjectRegistryManager.refresh(ProjectRegistryManager.java:320)
at org.eclipse.m2e.core.internal.project.ProjectConfigurationManager.configureNewMavenProjects(ProjectConfigurationManager.java:255)
at org.eclipse.m2e.core.internal.project.ProjectConfigurationManager.lambda$1(ProjectConfigurationManager.java:165)
at org.eclipse.m2e.core.internal.embedder.MavenExecutionContext.executeBare(MavenExecutionContext.java:394)
at org.eclipse.m2e.core.internal.embedder.MavenExecutionContext.execute(MavenExecutionContext.java:275)
at org.eclipse.m2e.core.internal.embedder.MavenExecutionContext.execute(MavenExecutionContext.java:214)
at org.eclipse.m2e.core.internal.project.ProjectConfigurationManager.importProjects(ProjectConfigurationManager.java:138)
at org.eclipse.m2e.core.ui.internal.wizards.ImportMavenProjectsJob$1.doCreateMavenProjects(ImportMavenProjectsJob.java:71)
at org.eclipse.m2e.core.ui.internal.wizards.AbstractCreateMavenProjectsOperation.run(AbstractCreateMavenProjectsOperation.java:56)
at org.eclipse.m2e.core.ui.internal.wizards.ImportMavenProjectsJob.runInWorkspace(ImportMavenProjectsJob.java:80)
at org.eclipse.core.internal.resources.InternalWorkspaceJob.run(InternalWorkspaceJob.java:43)
at org.eclipse.core.internal.jobs.Worker.run(Worker.java:63)
```
I can reproduce the bug with this test class:
```
package my.examples;
import java.util.stream.Stream;
import org.junit.jupiter.params.ParameterizedTest;
import org.junit.jupiter.params.provider.Arguments;
import org.junit.jupiter.params.provider.MethodSource;
public class TestWithSpecialChars {
@ParameterizedTest
@MethodSource("testArgs")
void test(String value) {
// do nothing
}
private static Stream testArgs() {
return Stream.of(
Arguments.of(
"\u0000 hi"
)
);
}
}
```
My eclipse version is 2023-12 (4.30.0) - Build id: 20231201-2043.
My Java version is 17.0.9 2023-10-17 LTS.
The steps to reproduce the bug are:
1. import the project in Eclipse
2. run the tests of the project
3. run the tests of the project (again)
4. from the "Test run history" of the JUnit view select the first test execution (the one indicated above, at step 2)
5. no test execution is shown in the JUnit view (it is blank)
6. an error appears in the Error Log
I have attached the whole sample project that exhibits the bug.
[special-char-test.zip](https://github.com/user-attachments/files/17659964/special-char-test.zip)
Contributor guide
Research direction
Reproduce the failure using the attached sample project and the six listed steps, then start from the JUnit view's test history import path and the error-log stack trace. Trace how the history XML for the parameterized test is loaded and why the special-character display name leads to a blank run. Done means the earlier test execution appears in the JUnit view without the reported import error.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java
- Domain
- testing
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100