Skip to content

Can't run or debug JUnit 5 from secondary class #859

Open

Description

@ZhengJun003

Environment:

OS: Windows
JDK: 8/12
Java Extensions:

  • Language Support for Java(TM) by Red Hat: 0.52.0
  • Debugger for Java: 0.23.0
  • Java Test Runner: 0.21.0

Steps to reproduce:

  1. Open the JUnit5 project in VSCode: https://github.com/ZhengJun003/junit5-samples/tree/testrunner
  2. Run MyFastTestIT and TestTemplateI in the test explorer

Result:

image

image


Added by Sheng Chen (@jdneo)
❗️Solution for those people who cannot run JUnit 5 from the Invisible project(dependency managed in lib folder)

Activity

  1. ZhengJun003 commented on Oct 29, 2019

    @ZhengJun003
    Author

    Java file's name and class name must be the same, otherwise, maven will skip these cases

  2. jdneo commented on Oct 30, 2019

    @jdneo
    Member

    So it turns out that this is an Eclipse side bug. It will happen when running a class name which is different from the compilation unit name.

    I'll reopen it until we fix it in the upstream.

    See: https://bugs.eclipse.org/bugs/show_bug.cgi?id=529722#c1

  3. changed the title [-]Can't run or debug junit5 'TestTemplate' and 'Meta Annotation' case[/-] [+]Can't run or debug junit5 from secondary class[/+] on Oct 30, 2019
  4. changed the title [-]Can't run or debug junit5 from secondary class[/-] [+]Can't run or debug JUnit 5 from secondary class[/+] on Oct 30, 2019
  5. geist-2501 commented on Nov 2, 2019

    @geist-2501
  6. ZhengJun003 commented on Nov 4, 2019

    @ZhengJun003
    Author
  7. geist-2501 commented on Nov 5, 2019

    @geist-2501
  8. jdneo commented on Nov 6, 2019

    @jdneo
  9. geist-2501 commented on Nov 6, 2019

    @geist-2501
  10. OneBigOwnage commented on Nov 10, 2019

    @OneBigOwnage
  11. jdneo commented on Nov 11, 2019

    @jdneo
  12. rajkundu commented on Nov 11, 2019

    @rajkundu
  13. jdneo commented on Nov 11, 2019

    @jdneo
  14. geist-2501 commented on Nov 11, 2019

    @geist-2501
  15. jdneo commented on Nov 11, 2019

    @jdneo
    Member

    Ok so here is the solution for those people who cannot run JUnit 5 from the Invisible project(dependency managed in lib folder):

    1. Update VS Code to 1.40.0
    2. Update Test Runner to 0.21.0
    3. Have the Junit Standalone Console jar in a lib folder

    Note: You may still cannot run JUnit 5 test if your class name is not the same as the Java file. This is a bug from the upstream Eclipse side.

  16. vwxyzjn commented on Nov 19, 2019

    @vwxyzjn

    Sheng Chen (@jdneo) Thanks that works!

  17. moinessim commented on Nov 20, 2019

    @moinessim

    Had the same problem, read this rolled back to v0.20.0 and it worked.
    I have last version of vscode and class names equal file names.
    Didn't try having the console jar in a lib folder. I'm using Maven. Don't want to save jars in source control.

  18. jdneo commented on Nov 20, 2019

    @jdneo
    Member

    moinessim Have you tried this solution?

  19. moinessim commented on Feb 27, 2020

    @moinessim

    moinessim Have you tried this solution?

    Hi Sheng Chen (@jdneo), I tried the following, but had the same error message.
    Adding the Junit Standalone Console jar:

    • in a lib folder in the project root directory.
    • in a lib folder next to the test class.
    • in the pom.xml as a Maven dependency with test scope.
  20. github-actions commented on Nov 12, 2025

    @github-actions

    Hi ZhengJun003, I'm an AI Support assistant here to help with your issue. While the team reviews your request, I wanted to provide some possible tips and documentation that might help you in the meantime.

    No known workaround exists for the “Failed to parse the JUnit launch arguments” error in the current Java Test Runner releases. Please try the following:

    • Update Java Test Runner to the latest version (≥ 0.23.0) and reload VS Code.
    • Clean your workspace (Developer: Clean Java Language Server Workspace) and restart.

    If the issue persists, file a new issue with full logs from the “Java Test Runner” output channel.

    Other references with low confidence

    The team will respond to your issue shortly. I hope these suggestions are helpful in the meantime. If this comment helped you, please give it a 👍. If the suggestion was not helpful or incorrect, please give it a 👎. Your feedback helps us improve!

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

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions