Vscode-java-test: Failed to run invisble project when using JDK11

Created on 19 Jan 2020  路  10Comments  路  Source: microsoft/vscode-java-test

Environment:

  • OS: Win10
  • JDK: 11.0.5
  • Java Extension:

    • Language Support for Java(TM) by Red Hat: 0.55.1

    • Debugger for Java: 0.24.0

    • Java Test Runner: 0.22.1

Repro steps:

  1. git clone project: https://github.com/ZhengJun003/invisble-project.git
  2. Run test project in the following level:

    • Workspace Root

    • Workspace Folder

Result:

Error: Failed to parse the JUnit launch arguments.
image

All 10 comments

Cannot repro from my side. But leave it open to see if there is any customer encountering the same issue.

I got same problem when running the test. Output:
Error: Failed to parse the JUnit launch arguments

In our code base, this same issue was caused by having an abstract *Test.java class (a base class for multiple tests). The workaround was to annotate it with @Ignore, so VSC does not try to execute it.

I'm having the same issue. Just updated to JDK 11 and got this error.

It only happens when I try to run or debug an individual test/test class. I can run the whole test suite with no problem.

@EuniceB Is it possible to share a sample project about this issue?

I have the same problem, My project is very simple maven project.

@ssabogalp would you mind to share a sample project to us?

Look, this is the repoduction steps:
Create project from maven (that template is simply a hello world class with a test):

mvn archetype:generate -DgroupId=com.sample -DartifactId=java-project -DarchetypeArtifactId=maven-archetype-quickstart -DinteractiveMode=false
Then, open that folder in visual studio, when you open it, it asks:
"The workspace contains Java projects. Would you like to import them?
reply yes.
Then, above the test, will appear something like link that says "Run test | Debug test", you click "run test", and it says:
Error: Failed to parse the JUnit launch arguments
I created a lib folder and add this to class path (I think my problem might be here because in an IDE that is don in a GUI so i never did it manually before)

Restart visual studio. Still showing :

Error: Failed to parse the JUnit launch arguments

@ssabogalp

Java Test Runner currently only support JUnit 4 & 5. the archetype you generated is using JUnit 3, so the functionality won't work.

Please specify the version to 1.4: mvn archetype:generate -DarchetypeGroupId=org.apache.maven.archetypes -DarchetypeArtifactId=maven-archetype-quickstart -DarchetypeVersion=1.4

Also, the lib folder is only used to store the libs for the project that does not have build tools. Since you are using Maven now, so please add/remove the dependencies via editing the pom.xml.

Hi, my first try was added it to the pom, but it wasn't working so I tried the path. But now everything works, with the same dependency in pom:

<dependency>
    <groupId>junit</groupId>
    <artifactId>junit</artifactId>
    <version>4.12</version>
    <scope>test</scope>
</dependency>

I do not understand why it was failing. I believe the old dependency was in cache or something like that, but I restarted visual studio and it kept failing, but at some point it just worked in any way. Thanks.

Was this page helpful?
0 / 5 - 0 ratings