Unable to run Junit 5 Tests using Java Test Runner
Nobody has claimed this yet.
Assessment
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Newbie friendliness
- 35/100
- Issue type
- Bug
- Clarity
- Mostly clear
- Activity status
- Stale
- Tech stack
- java, vscode
- Domain
- devtools, testing-qa
Research direction
Start by reproducing the failure with the dependencies in build.gradle and the java.test.config settings in settings.json, then run CalculatorTest through Java Test Runner. Read the reported ServiceConfigurationError and the JUnit5TestReference stack trace to trace which test engines are being loaded. Done means identifying why VintageTestEngine is requested and documenting a verified resolution or exclusion path.
Written by the indexing model from the issue text.
Description
Hello,
We have our own vscode which is running inside a docker container & running on a browser. We are using
- Java 17 -> which is from the vscode extension "Language Support for Java(TM) by Red Hat -> v1.35.1"
- Debugger for Java extension -> v0.56.2
- Test Runner for Java extension -> v0.40.1
- Build Tool is Gradle for Java extension -> v3.13.2023120800
I have added the below dependencies in build.gradle file:
testImplementation 'org.junit.jupiter:junit-jupiter:5.12.0'
testImplementation 'org.junit.platform:junit-platform-launcher:1.12.0'
Running simple test:
`package platform.demo.unittest;
import org.junit.jupiter.api.Test;
import static org.junit.jupiter.api.Assertions.assertEquals;
public class CalculatorTest {
@Test
public void testAddition() {
int result = 2 + 3;
assertEquals(5, result, "2 + 3 should equal 5");
}
}`
Below is the settings I added to the User > settings.json:
"java.test.config": { "name": "testconfig", "vmArgs": [ "-Dremoting.location=/home/myconnector/remoting.xml" ], }, "java.test.defaultConfig": "testconfig"
When I run the test by using Java Test Runner, I get the following error log:
java.util.ServiceConfigurationError: org.junit.platform.engine.TestEngine: Provider org.junit.vintage.engine.VintageTestEngine not found at java.base/java.util.ServiceLoader.fail(ServiceLoader.java:593) at java.base/java.util.ServiceLoader$LazyClassPathLookupIterator.nextProviderClass(ServiceLoader.java:1219) at java.base/java.util.ServiceLoader$LazyClassPathLookupIterator.hasNextService(ServiceLoader.java:1228) at java.base/java.util.ServiceLoader$LazyClassPathLookupIterator.hasNext(ServiceLoader.java:1273) at java.base/java.util.ServiceLoader$2.hasNext(ServiceLoader.java:1309) at java.base/java.util.ServiceLoader$3.hasNext(ServiceLoader.java:1393) at java.base/java.lang.Iterable.forEach(Iterable.java:74) at org.junit.platform.launcher.core.LauncherFactory.collectTestEngines(LauncherFactory.java:158) LauncherFactory.java:158 at org.junit.platform.launcher.core.LauncherFactory.createDefaultLauncher(LauncherFactory.java:134) LauncherFactory.java:134 at org.junit.platform.launcher.core.LauncherFactory.lambda$create$2(LauncherFactory.java:128) LauncherFactory.java:128 at org.junit.platform.launcher.core.ClasspathAlignmentCheckingLauncherInterceptor.intercept(ClasspathAlignmentCheckingLauncherInterceptor.java:25) ClasspathAlignmentCheckingLauncherInterceptor.java:25 at org.junit.platform.launcher.core.DefaultLauncherSession.<init>(DefaultLauncherSession.java:57) DefaultLauncherSession.java:57 at org.junit.platform.launcher.core.SessionPerRequestLauncher.createSession(SessionPerRequestLauncher.java:75) SessionPerRequestLauncher.java:75 at org.junit.platform.launcher.core.SessionPerRequestLauncher.discover(SessionPerRequestLauncher.java:55) SessionPerRequestLauncher.java:55 at org.eclipse.jdt.internal.junit5.runner.JUnit5TestReference.<init>(JUnit5TestReference.java:46)
- With Junit5 dependency, it should use junit-jupiter-engine rt?
- If I want to run the Junit 4 Tests with Junit5 then I need to use junit-vintage rt?
- I am still not understanding on why it is complaining the junit-vintage-engine?
I was verifying any transitive dependency due to addition of dependencies in my gradle file -> Zero records found.
- Can you help me what the error log says?
- How to resolve it?
- Is Java Test Runner using Junit-vintage-engine to run tests? If so, how can i exclude it?
- Or something Else? Any leads will probably help me a lot
- Dominant language
- TypeScript
- Stars
- 340
- Forks
- 173
- Avg merge
- 1d 2h
- Merged PRs (30d)
- 17
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from microsoft/vscode-java-test
-
ai-triaged bug investigating junit test-discovery test-execution
Difficulty 4/5 3-5 days Newbie friendliness 42/100
microsoft/vscode-java-test#1897 · 1 comment ·
-
ai-triaged bug gradle high-priority test-execution
microsoft/vscode-java-test#1880 · 2 comments · 1 assignee ·
-
ai-triaged gradle junit test-execution ux
microsoft/vscode-java-test#1878 · 3 comments · 1 assignee ·
-
ai-triaged enhancement junit low-priority test-execution ui
Difficulty 4/5 3-5 days Newbie friendliness 48/100
microsoft/vscode-java-test#1836 · 4 comments ·
-
ai-triaged enhancement gradle investigating junit low-priority test-reporting
Difficulty 4/5 3-5 days Newbie friendliness 48/100
microsoft/vscode-java-test#1824 · 1 comment ·
All issues in microsoft/vscode-java-test
Similar issues
-
Difficulty 2/5 1-3 hours Newbie friendliness 84/100
copse-dev/agent-pane#2953 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 84/100
Eynzof/Hermes-CN-Desktop#610 ·
-
bug clawsweeper:linked-pr-open clawsweeper:needs-live-repro clawsweeper:no-new-fix-pr impact:message-loss issue-rating: 🐚 platinum hermit P2 regression
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
-
enhancement
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
-
calcite-components needs triage refactor
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
Esri/calcite-design-system#15203 ·