Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
ZhengJun003 opened this issue Oct 29, 2019 · 17 comments
Open

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

ZhengJun003 opened this issue Oct 29, 2019 · 17 comments

Comments

@ZhengJun003
Copy link

ZhengJun003 commented Oct 29, 2019

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 @jdneo
❗️Solution for those people who cannot run JUnit 5 from the Invisible project(dependency managed in lib folder)

@ZhengJun003
Copy link
Author

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

@jdneo
Copy link
Member

jdneo commented Oct 30, 2019

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

@jdneo jdneo reopened this Oct 30, 2019
@jdneo jdneo changed the title Can't run or debug junit5 'TestTemplate' and 'Meta Annotation' case Can't run or debug junit5 from secondary class Oct 30, 2019
@jdneo jdneo changed the title Can't run or debug junit5 from secondary class Can't run or debug JUnit 5 from secondary class Oct 30, 2019
@geist-2501

This comment has been minimized.

@ZhengJun003

This comment has been minimized.

@geist-2501

This comment has been minimized.

@jdneo

This comment has been minimized.

@geist-2501

This comment has been minimized.

@OneBigOwnage

This comment has been minimized.

@jdneo

This comment has been minimized.

@rajkundu

This comment has been minimized.

@jdneo

This comment has been minimized.

@geist-2501

This comment has been minimized.

@jdneo
Copy link
Member

jdneo commented Nov 11, 2019

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.

@vwxyzjn
Copy link

vwxyzjn commented Nov 19, 2019

@jdneo Thanks that works!

@moinessim
Copy link

moinessim commented Nov 20, 2019

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.

@jdneo
Copy link
Member

jdneo commented Nov 20, 2019

@moinessim Have you tried this solution?

@moinessim
Copy link

@moinessim Have you tried this solution?

Hi @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.

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

No branches or pull requests

7 participants