1

At some point in the last week I found that I can no longer see the following prompts at the top of already working unit tests in VS Code

  • Run All Tests
  • Run Test | Debug Test

No "Run All Tests" or "Run Test"

While this is absolutely a nice-to-have, it does affect my workflow quite a bit. I've tried removing and setting up a fresh WSL instance using the generic Ubuntu installation.

VS Code Info:

  • Version: 1.78.0 (user setup)
  • Commit: 252e5463d60e63238250799aef7375787f68b4ee
  • Date: 2023-05-03T20:09:00.748Z
  • Electron: 22.4.8
  • Chromium: 108.0.5359.215
  • Node.js: 16.17.1
  • V8: 10.8.168.25-electron.0
  • OS: Windows_NT x64 10.0.19045
  • Sandboxed: No

I have the latest versions of the extensions included in the:

  • Salesforce Extension Pack
  • Salesforce Extension Pack (Expanded)

I've installed sfdx through npm. I have tried using both of the following packages

  • sfdx-cli
  • @salesforce/cli - Currently in use

I found this post StackExchange: Unable to Run Tests from VSCode which suggests disabling "Use Apex Library for Apex CLI Commands, however this option is not visible in my preferences to try toggling.

My npm list output:

├── @lwc/[email protected]
├── @prettier/[email protected]
├── @salesforce/[email protected]
├── @salesforce/[email protected]
├── @salesforce/[email protected]
├── @salesforce/[email protected]
├── @salesforce/[email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── lint-s[email protected]
├── [email protected]
└── [email protected]

Java Info

openjdk 17.0.6 2023-01-17
OpenJDK Runtime Environment (build 17.0.6+10-Ubuntu-0ubuntu122.04)
OpenJDK 64-Bit Server VM (build 17.0.6+10-Ubuntu-0ubuntu122.04, mixed mode, sharing)

When clicking on the "Testing" tab in VS Code, there are no longer any unit test classes or functions listed there.

I've also tried setting things up with the bare minimum on a fresh install of Windows 11 using WSL2 & Ubuntu, with the same result.

Has anyone else experienced this or have any suggestions I could try? Any help suggestions greatly appreciated.

1 Answer 1

2

So I spent most of the past weekend cross checking what the settings are on my work laptop, and the only difference was the VS Code version and the fact that there is nothing set for: "salesforcedx-vscode-apex.java.home": in settings.

Running which java gives me the same output on my personal machines and work machine: /usr/bin/java. This was set as my java.home previously before it stopped working.


I have fixed the issue and I feel more than a bit silly:

"salesforcedx-vscode-apex.java.home": "/usr/lib/jvm/java-17-openjdk-amd64"

enter image description here

1
  • I had the same problem on Windows 10. For me this setting had been filled, with C:\\Program Files\\java-1.8.0. Also: the xml.java.home setting was empty. I filled both of these with C:\\Program Files\\Zulu\\zulu-17 (yes, backslash must be escaped) and now I can run unit tests again in VS! Sep 20 at 10:28

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .