function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Tony Rush 3Tony Rush 3 

Why are "Run All Tests" and "Run Test" links not showing on test classes in Visual Studio Code?

I am looking at this page:

https://developer.salesforce.com/tools/vscode/en/apex/testing/

It mentions "Run All Tests" and "Run Test". The problem is that I don't see these links within my Test class. I did click the 'Beaker' icon and try to run tests that way, but I get an error that "Java runtime could not be located" and pointing me to this site:

https://developer.salesforce.com/tools/vscode/en/getting-started/java-setup

Ok, well I do have Java installed at 'C:\Program Files (x86)\Java\jre1.8.0_231' so I tried to set that as the Java home setting. But still unfortunately testing via the side panel doesn't work, and I still don't see those "Run Test" links.

Can someone provide some guidance please? Does this problem have to do with that Java setting and if so what should I be setting that to exactly?
karthikeyan perumalkarthikeyan perumal
Hello, 

What version of the Salesforce extensions do you have?  
We do require  VScode 1.26 for the latest version of the Salesforce extensions.  let me know if its not works..

Thanks
karthik
 
karthikeyan perumalkarthikeyan perumal
Hello, 
dont use jave 11 or others. you just need jave 8 only. 

Download  "jdk-8u231-windows-x64.exe"  from here 
https://www.oracle.com/technetwork/java/javase/downloads/jdk8-downloads-2133151.html

Install it, 

set you VS code java home  like below. 

File--> preference-> settings--- > Type " Apex" you have to  change your java home like below, 

User-added image

then close vs code and reopen. wait for all extension activation. then click on test  image from right side panel  the opne the class file you able to see  " run test" and run all test like below, 

User-added image

hope this will solve your issue. 

Thanks
karthik
 
Tony Rush 3Tony Rush 3
Thanks, that did it! I had downloaded the JRE but needed the JDK (which requires a free Oracle account to download). Then I just had to set Java Home to C:\Program Files\Java\jdk1.8.0_231