I am new to VSCode.

The Org is setup in VSCode.

ForceCode, vforce, Salesforce CLI Integration and some other extensions installed in the VSCode.

Org is authorized. I am able to save my changes in the Org using VSCode.

I was trying to run the unit test class using VSCode.

When I right-click in a blank area in the test class, I see following pop-up menu:

enter image description here

I tried browsing the main menus of VSCode to see if there is an option to run the test classes but not able to find any.

I have the option to run the test class using developer console, is there any way I can run the test class from VSCode itself and see results?

Is there any extension which is needed to run test classes?

  • I know this is an old post, but If you are from java background then try (Intellij + illuminated cloud 2) as plugin. The plugin is a paid plugin, but it combines development, deployment, log analysis, test run , anonymous apex and many more under one window, which is really helpful. Commented Nov 18, 2020 at 5:41

1 Answer 1


You have three options for this.

  1. Run Invoke Apex Tests Command

    enter image description here

You will be prompted for a Test class name or Run all.

enter image description here

  1. From Test Window

Edit: Added screenshot for Test Window.

enter image description here

You will find a list of all unit tests there. enter image description here

  1. From test class itself.

    a. 'Run All Test' button above the definition of Test Class.

    b. 'Run Test' button above the definition of the test method.

    enter image description here

  • 1
    I am able to run test cases using option 1. There is no test classes in my APEX TESTS window. I am not able to see Run AllTests and Run Test button on the test class. If I can see such buttons on the test class, it will be quick to run test cases. Commented Jul 30, 2019 at 9:59
  • @वरुण I have edited the post and added screenshot for the Test Window Commented Jul 30, 2019 at 10:16
  • I was already checking in the Test window, but there were no test cases there. Clicked on Refresh button also but the cases were not getting loaded. Commented Jul 30, 2019 at 10:19
  • 5
    It turns out I needed the following line in my settings.json file: "salesforcedx-vscode-apex.java.home": "/opt/zulu11.35.15-ca-jre11.0.5-linux_x64/",
    – user6856
    Commented Jun 9, 2020 at 19:14
  • 1
    very thorough answer, well written. thanks @rahulgawale
    – pb2q
    Commented Aug 21, 2020 at 18:47

You must log in to answer this question.

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