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

Cannot run from src/test anymore #413

Closed
clankill3r opened this issue Sep 9, 2018 · 13 comments
Closed

Cannot run from src/test anymore #413

clankill3r opened this issue Sep 9, 2018 · 13 comments
Assignees
Labels
Milestone

Comments

@clankill3r
Copy link

(maven project)
Since today I noticed when I try to start debugging something from the src/test folder I get:

Error: Could not find or load main class com.github.whatever.Whatever

When I move the file to the src/main folder it works. Before this was not the case.

It broke from one day to the other, so I guess VSCode or one of the plugins broke.
I have no clue how to tackle this problem. Any help is welcome.

Environment
  • Operating System: OSX 10.12.6
  • JDK version: 1.8
  • Visual Studio Code version: 1.27.1
  • Java extension version: 0.30.0
  • Java Debugger extension version: 0.12.2
@andxu
Copy link
Contributor

andxu commented Sep 10, 2018

Yes, it is caused by the code fix for this issue #111, for a workaround, you can move it to non-test folder, I will detect whether you are staring main class from test source folders later.

@andxu andxu added the bug label Sep 10, 2018
@andxu andxu self-assigned this Sep 10, 2018
@lashchev
Copy link

Same thing here (same VSCode, Java Tools and Java Debugger versions, but under Windows) - cannot debug unit tests anymore. I cannot move all unit tests to other folder - build and other tools rely on standard maven project structure.

  1. Debug session starts, but after few (2-5) steps (F10) it hangs. Pressing Shift+F5 stops debug session.
  2. Cannot add some local variables and method parameters to the Watch list.
  3. Mouse over doesn't show values for many variables
  4. Conditional breakpoints never stop. If I set them - debug session starts and runs forever.

Language Support for Java log panel shows "Exception processing async thread queue"

@andxu
Copy link
Contributor

andxu commented Sep 10, 2018

Unit test by click Debug Test code lens should not be influenced, please go to the https://github.com/Microsoft/vscode-java-test/issues to raise an issue if you can not run unit test, but if you want to run the main method at test classes, it should not work by now due to my change.

@andxu
Copy link
Contributor

andxu commented Sep 12, 2018

@jdneo to take a look at test runner side.

@joshryanne
Copy link

glad to know there wasn't wrong with my dev pc :) tried everything(uninstalling vs code, using insider edition, uninstalling plugins etc. manual classpath) but coudn't fix it. eventually went to eclipse temporarily :). so i'm happy to know what was the cause. :)

@clankill3r
Copy link
Author

No I hope it get's fixed fast :)

@joshryanne
Copy link

i rolled back mine to 0.11.0 till it is solved :)

@lashchev
Copy link

lashchev commented Sep 14, 2018

@andxu It fails for me from both places - from Test runner and Code Lens. Actually, I rarely use Test Runner to start tests, because when I develop a method/test I run/debug tests that I am working on or fixing. I use Test Runner is for big/sweep runs.

@andxu
Copy link
Contributor

andxu commented Sep 14, 2018

@lasalame I will work on this items after the release 0.13.0, can you help to give me a sample project which doesn't work for both places(attach the project folder here in this issue)?

@andxu andxu added this to the 0.14.0 milestone Sep 20, 2018
@andxu andxu mentioned this issue Sep 26, 2018
7 tasks
@andxu
Copy link
Contributor

andxu commented Sep 26, 2018

microsoft/java-debug#232

@andxu
Copy link
Contributor

andxu commented Sep 27, 2018

To test it:

  1. maven:
    a. git clone https://github.com/andxu/samples and git checkout andy_test
    b. open the simple-app folder, and open the samples\simple-app\src\test\java\hello\GreeterTest.java
    c. set breakpoint on line 18
    d. click the debug code lens before the main method
    e. verify the GreeterTest is launched with the correct class path.

image

0 21 57548 n:\jdk1.8.0_181\bin\java -Xdebug -Xnoagent -Djava.compiler=NONE -Xrunjdwp:transport=dt_socket,address=localhost:52207,server=n,suspend=y -Dfile.encoding=UTF-8 -cp N:\andxu\samples\simple-app\target\classes;N:\andxu\samples\simple-app\target\test-classes;C:\Users\andxu\.m2\repository\org\apache\commons\commons-lang3\3.6\commons-lang3-3.6.jar;C:\Users\andxu\.m2\repository\joda-time\joda-time\2.9.2\joda-time-2.9.2.jar;C:\Users\andxu\.m2\repository\junit\junit\4.12\junit-4.12.jar;C:\Users\andxu\.m2\repository\org\hamcrest\hamcrest-core\1.3\hamcrest-core-1.3.jar hello.GreeterTest

  1. gradle:
    a. git clone https://github.com/andxu/samples and git checkout andy_test
    b. open the gradle-sample folder, and open the samples\gradle-sample\src\test\java\hello\GreeterTest.java
    c. set breakpoint on line 18
    d. click the debug code lens before the main method
    e. verify the GreeterTest is launched with the correct class path(same with maven scenario above).

@andxu andxu closed this as completed Sep 27, 2018
@clankill3r
Copy link
Author

clankill3r commented Oct 1, 2018

Can other people get this to work?
I get:
Error: Could not find or load main class hello.GreeterTest.

(Edit: I guess I have to wait for the 0.14.0 release)...

@clankill3r
Copy link
Author

@joshryanne I want to roll back as well, do you happen to know what the VSIX link is?

It such a pain to find it. The link should be close to this:

https://ms-vscode.gallery.vsassets.io/_apis/public/gallery/publisher/ms-vscode/extension/vscjava.vscode-java-debug/0.12.0/assetbyname/Microsoft.VisualStudio.Services.VSIXPackage

But we are dealing with microsoft here...

@Eskibear Eskibear mentioned this issue Oct 10, 2018
11 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants