-
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
TestSuite are not discovered, can't launch test (since end of 2018) #576
Comments
Looks very similar to this issue: #470 Could you please check if the |
You're right @jdneo <classpathentry kind="src" path="src">
<attributes><attribute name="test" value="true"/></attributes>
</classpathentry> It could be great to add this to a check list, if no test is display. Thanks. |
This didn't work for me |
@noschang What does your classpath looks like? |
@jdneo It looks exactly like this: <?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="src" output="target/classes" path="src/main/java">
<attributes>
<attribute name="optional" value="true"/>
<attribute name="maven.pomderived" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-14">
<attributes>
<attribute name="maven.pomderived" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="con" path="org.eclipse.m2e.MAVEN2_CLASSPATH_CONTAINER">
<attributes>
<attribute name="maven.pomderived" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="src" output="target/test-classes" path="src/test/java">
<attributes>
<attribute name="test" value="true"/>
<attribute name="optional" value="true"/>
<attribute name="maven.pomderived" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="src" path="target/generated-sources/annotations">
<attributes>
<attribute name="optional" value="true"/>
<attribute name="maven.pomderived" value="true"/>
<attribute name="ignore_optional_problems" value="true"/>
<attribute name="m2e-apt" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="src" output="target/test-classes" path="target/generated-test-sources/test-annotations">
<attributes>
<attribute name="optional" value="true"/>
<attribute name="maven.pomderived" value="true"/>
<attribute name="ignore_optional_problems" value="true"/>
<attribute name="m2e-apt" value="true"/>
<attribute name="test" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="output" path="target/classes"/>
</classpath> Actually it is automatically regenerated each time I open VSCode. From what I've been reading on several issues, this seems to be correct. I also tried to remove the attributes <build>
<testSourceDirectory>${basedir}/src/test/java</testSourceDirectory>
</build> But nothing seems to work. I'm thinking to abandon the programmer life and become a dancer in a night club, maybe I'll have more luck. LOL |
@jdneo I also tried this: {
"java.test.config": {
"name": "MyTests",
"workingDirectory": "${workspaceFolder}"
}
} And this: {
"java.import.gradle.enabled": false,
"java.import.maven.enabled": true
} And tried creating a workspace and adding my folder to it, instead of opening it directly as a folder. I've tried every possible solution suggested on several places of the Internet. No luck tho! At least I can run my application. Just can't run the tests. Is there any chance that it is a problem with the JDK? I'm currently using adoptopenjdk-14-openj9 as the JDK for both, running the Java Extension Pack and running my application. |
@noschang thanks for sharing. The configuration looks good to me. Would you mind to share a sample project to us? You can remove all the code which you don't want to share, just make sure that sample project can be used to reproduce the issue. |
@jdneo any Java project I try to open gives me the same results. I'm sending you a brand new project that I created using VSCode pallete command "Create Java Project". Here it is: MyProject1.zip, and the process I've followed: 1. Creating the project2. Checking out that it runs flawlesslyIt is detected as a Java Project and I can run the application normally 3. Trying to run the testsThe project is listed in the tests panel, but no test is detected. Also, no option to run the test through the editor. Trying to run the tests from the test panel gives an error message: And trying to run it from the file itself gives a friendly message: Finally, adding the folder to a workspace instead of opening it directly doesn't work also 4. Special thanks!Thank you very much! I appreciate your help!! I hope you can help me and everybody on community that is having the same problems. I'm liking very much to code Java on VSCode and I'm planning to use it as my primary IDE for all projects (Java and not Java). But until I can get the tests to work I can't abandon Eclipse. :-) |
@jdneo oh my goodness!! You saved me! Yes, based on your answer I investigated and remembered that my projects are stored inside a symlinked folder. I moved the project to a regular folder and it worked like a charm!! I didn't have to do anything! Just move the folder. Thank you very much!! I just wonder why this is a problem. From my point of view this should not be a issue, since the O.S. should abstract it from the programs. I got really curious now. This is a red flag for me, if VSCode has problems with symlinks, maybe this could explain some odd problems that I have in other software too. Here my boy! Take some cookies as an acknowledgment! You deserve!! |
Good to know we found the root cause! It seems that VS Code do have some issues with the symlink, see: microsoft/vscode#74104, though I don't know the details of them. 🤔 |
Hi,
I found this extension very useful, thank you.
I'm not able to see and run Junit test since enf of 2018, I was waiting an update that fix the problem, I thought I saw an issue about that but seems to be closed now.
I have a simple eclipse java project with some src(s) and lib(s) and jar(s) declared in classpath that I edit manually, it works great for compilation, launching my main(s). But since 2 month, I cannot see decoration in my tests classes and I'm not able to run it.
Is it a bug?
Do I need to declare something in a setting. I have no pattern to organize my tests, there are in some packages. The only pattern I used (not always) is that my test classes starts with JUnit....java
Please can you help ? so I can launch/debug test from vscode that is really helpful and powerful!
thanks for your help
The text was updated successfully, but these errors were encountered: