-
Notifications
You must be signed in to change notification settings - Fork 134
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
VS Code does not recognize junit tests #1692
Comments
I did some search and came across mention of a |
@siddhsql What if you run |
i have done that many times. same result.
…On Thu, May 16, 2024 at 6:59 PM Sheng Chen ***@***.***> wrote:
@siddhsql <https://github.com/siddhsql> What if you run Java: Clean Java
Language Server Workspace
—
Reply to this email directly, view it on GitHub
<#1692 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/A6NWEKY7MB2YKSRO2JZGRNTZCVQBVAVCNFSM6AAAAABH2WQIISVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDCMJWGQ4TCNJTGE>
.
You are receiving this because you were mentioned.Message ID:
***@***.***>
|
Would you mind sharing the project to us? |
i am not able to do that. it is a big project with many modules.
…On Thu, May 23, 2024 at 1:59 AM Sheng Chen ***@***.***> wrote:
Would you mind sharing the project to us?
—
Reply to this email directly, view it on GitHub
<#1692 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/A6NWEK2UQEV3AEEWPHRV4L3ZDWVXHAVCNFSM6AAAAABH2WQIISVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDCMRWGU4DSNJZGM>
.
You are receiving this because you were mentioned.Message ID:
***@***.***>
|
If there are Please try to close your vscode, remove the above three files and open your vscode. |
I don't have any of these files. I have a settings.json under .vscode and
it has following in it:
```
{
"java.configuration.updateBuildConfiguration": "automatic",
"java.compile.nullAnalysis.mode": "disabled",
"java.test.config": {
"vmArgs": ["--enable-preview", "--add-modules",
"jdk.incubator.vector", "--add-opens",
"java.base/java.lang.invoke=ALL-UNNAMED",
"--add-opens",
"java.base/jdk.internal.misc=ALL-UNNAMED",
"--add-opens",
"java.base/sun.security.util=ALL-UNNAMED",
"--add-opens",
"java.base/jdk.internal.ref=ALL-UNNAMED",
"--add-opens", "java.base/java.lang.reflect=ALL-UNNAMED",
"--add-opens", "java.base/java.nio.channels.spi=ALL-UNNAMED",
"--add-opens", "java.base/sun.nio.ch=ALL-UNNAMED", "--add-opens",
"java.base/sun.nio.cs=ALL-UNNAMED", "--add-opens",
"java.base/java.nio.charset=ALL-UNNAMED",
"--add-opens", "java.base/java.lang.ref=ALL-UNNAMED",
"--add-opens", "java.base/java.nio=ALL-UNNAMED", "--add-opens",
"java.base/java.nio.channels=ALL-UNNAMED",
"--add-opens", "java.base/java.io=ALL-UNNAMED", "--add-opens",
"java.base/jdk.internal.loader=ALL-UNNAMED", "--add-opens",
"java.base/java.util.regex=ALL-UNNAMED",
"--add-opens", "java.base/java.security=ALL-UNNAMED",
"--add-opens", "java.base/java.net=ALL-UNNAMED", "--add-opens",
"java.base/sun.nio.fs=ALL-UNNAMED",
"--add-opens", "java.base/java.lang=ALL-UNNAMED", "--add-opens",
"java.base/java.util.concurrent=ALL-UNNAMED", "--add-opens",
"java.base/java.util.concurrent.atomic=ALL-UNNAMED",
"--add-opens", "java.base/java.util.concurrent.locks=ALL-UNNAMED",
"--add-opens", "java.base/java.util=ALL-UNNAMED"
]
},
"git.ignoreLimitWarning": true
}
```
I also tested on a Windows machine and there too VS Code does not recognize
junit tests - no green button is displayed beside the tests.
…On Thu, May 23, 2024 at 11:54 PM Sheng Chen ***@***.***> wrote:
If there are .settings, .classpath, .project files located under your
project folder.
Please try to close your vscode, remove the above three files and open
your vscode.
—
Reply to this email directly, view it on GitHub
<#1692 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/A6NWEKYAUVMEG72H2EX766TZD3P2HAVCNFSM6AAAAABH2WQIISVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDCMRYG4YTENRUG4>
.
You are receiving this because you were mentioned.Message ID:
***@***.***>
|
it does not work for me though. i have tried cleaning the workspace many
times.
…On Wed, May 29, 2024 at 3:56 PM Diego Cuenca ***@***.***> wrote:
Hi, I solved this problem in JAVA PROJECTS, Clean Workspace. Then the
green buttons are displayed in tests.
image.png (view on web)
<https://github.com/microsoft/vscode-java-test/assets/41596984/038b7bad-f5c6-4349-b1cf-d3783e3ba431>
—
Reply to this email directly, view it on GitHub
<#1692 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/A6NWEKYFJLUPEF4GY4E2YG3ZEZMIZAVCNFSM6AAAAABH2WQIISVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDCMZYGM4DKMZVGA>
.
You are receiving this because you were mentioned.Message ID:
***@***.***>
|
@siddhsql Is your problem resolved now? |
There is an undergoing effort about support running test in gradle build server: microsoft/build-server-for-gradle#144 Once Once it's done, I'll check how to integrate that into the test runner extension. |
@jdneo 我遇到了同样的问题。 执行mvn test-compile -f 可以编译成功。但是在vscode里面找不到测试类。 清除目录、clear workspace都重复了很多次,都不解决问题。 能麻烦看下可能是什么问题导致? |
@aisong Could you share a sample project for your issue? |
@aisong Have you set |
not set. settings: {
} |
no my problem is not solved. i don't use gradle. i am using maven with junit 5. thanks. |
this is an unrelated question but does anyone know where does VS Code store the compiled classes? there is a |
Yes
This is a known issue: redhat-developer/vscode-java#314 |
@jdneo 我终于找到我这里的问题出在哪里。但不知道为什么会这样。 在我的pom中引入了一个本地仓库的依赖,如果去掉它,ide会正常,如果引入它就会出现问题。 能否从日志中判断出具体是什么问题? |
this seems like a serious issue to me and am surprised its not fixed even after 7 years. |
@siddhsql I also came across the same problem, but, I resolved this problem by adding a .classpath file. Sometimes, VSC cannot detect src\java\test as test source folder automatically( i don't know why ). You can enhance it by adding a .classpath file to tell vsc which folder should regarded as test source folder. |
Hi Simon, thanks. could you elaborate please with more details?
…On Sat, Nov 30, 2024 at 12:07 AM SimonLiu ***@***.***> wrote:
@siddhsql <https://github.com/siddhsql> I also came across the same
problem, but, I resolved this problem by adding a .classpath file.
Sometimes, VSC cannot detect src\java\test as test source folder
automatically( i don't know why ). You can enhance it by adding a
.classpath file to tell vsc which folder should regarded as test source
folder.
—
Reply to this email directly, view it on GitHub
<#1692 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/A6NWEK2H2DBT7B3ZSEUFSFT2DFW37AVCNFSM6AAAAABSYI3FNOVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDKMBYHA4DAMRQHA>
.
You are receiving this because you were mentioned.Message ID:
***@***.***>
|
I am following the steps at this page to run Junit5 tests with VS Code and Maven. I have these extensions installed:
and my
pom.xml
has:I have put my test classes in
src/test/java
. but VS Code does not detect JUNIT5 tests. the green "lenses" or "buttons" do not show up next to the tests. In one of the logs I could see:and not sure if it is because of this.
related: #470
The text was updated successfully, but these errors were encountered: