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

Executing tests gives me "Failed to get workspace folder from test item" #1463

Closed
halloleo opened this issue Aug 1, 2022 · 12 comments
Closed

Comments

@halloleo
Copy link

halloleo commented Aug 1, 2022

I have created a small Java example project with a test in a package. VS code recognizes the project and the test perfectly (e.g. I was able to use the Source Actions... --> Generate Tests... command to create the test file).

However when I execute the test I get the following error balloon:

""Failed to get workspace folder from test item: $(symbol-class) ClassInPackageTest."

Any idea how to fix this?


PS: Happy to share the complete project (e.g. as an archive), but don't know where's the best spot to share it.

@jdneo
Copy link
Member

jdneo commented Aug 1, 2022

Yes, sharing a sample project could help me understand the problem. Using an archive works for me. :)

@halloleo
Copy link
Author

halloleo commented Aug 1, 2022

Ok, here some screenshots to start with. First the project in the Explorer panel:

Explorer view

Then in the Testing panel:

Testing view

And finally the full window with the error balloons:

Full window

Hope this help!

@halloleo
Copy link
Author

halloleo commented Aug 1, 2022

And the full content of the settings.json:

{
    "java.project.sourcePaths": ["src"],
    "java.project.outputPath": "bin",
    "java.project.referencedLibraries": [
        "lib/**/*.jar"
    ]
}

ps: I have now I idea how I can upload a zip file here to the issue area of GitHub - that's why I sent the screenshots.

@jdneo
Copy link
Member

jdneo commented Aug 1, 2022

The last screenshot looks similar with this issue: #1394

Will it help if you trigger Java: Clean Java Language Server Workspace and restart VS Code?

@halloleo
Copy link
Author

halloleo commented Aug 1, 2022

Thanks, @jdneo, for looking at this!

I just tried Cleaning the JLS Workspace, but I get the same error.

Is there a way to provide the workspace location manually?

@jdneo
Copy link
Member

jdneo commented Aug 1, 2022

ps: I have now I idea how I can upload a zip file here to the issue area of GitHub - that's why I sent the screenshots.

You can just simply drag the zip file into the comment input box, should work.

@halloleo
Copy link
Author

halloleo commented Aug 1, 2022

You can just simply drag the zip file into the comment input box, should work.

Cool! So here the zip of the demo project: packaged-tester.zip

@jdneo
Copy link
Member

jdneo commented Aug 1, 2022

Hmm, the project works well on my Windows machine:
image

Are you working on a symlink folder in Linux? If the answer is yes, then should be related with this upstream issue: microsoft/vscode#74104

@halloleo
Copy link
Author

halloleo commented Aug 1, 2022

Are you working on a symlink folder in Linux?

I definitely work on Linux (RHEL 7 and RHEL 8). As for the symlink: That might be the case. I'll check tomorrow when I'm back at the machine.

Does this mean when I open the project via its direct path (no symlink part in the path), then it should work?

@halloleo
Copy link
Author

halloleo commented Aug 2, 2022

Does this mean when I open the project via its direct path (no symlink part in the path), then it should work? (Always nice to quote myself. 😉)

Yes, it DOES work when I open the project through its direct path (no symlink part in the path). All tests work. -Thanks for pointing out the possible issues, @jdneo!

IMHO this is a bug. Symlinked project directories should work, I think.

@jdneo
Copy link
Member

jdneo commented Aug 2, 2022

Unfortunately, this issue is out of the control of the test runner extension. According to the discussion, it's related with Electron framework.

I'm closing this issue since we have an issue: #630 to track this actually. I'm sorry that so far, I cannot provide any more help on this

@halloleo
Copy link
Author

halloleo commented Aug 2, 2022

Makes all sense.

I'm sorry that so far, I cannot provide any more help on this.

Well, for me, using direct, canonicalised links is good enough. 😄

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

2 participants