This is a summary of instructions for how to view unit test coverage in VS Code as an alternative to using Salesforce’s Developer Console. The official guide, Apex Tests | Salesforce for VSCode is a great resource, but this post also includes a video walkthrough.
In VS Code click Code > Preferences > Settings and search for Apex Coverage.
salesforcedx-vscode-core.retrieve-test-code-coverageto true by checking the box of that setting.
Click the beaker icon in the Activity Bar on the left side of the VS Code editor and run a test or multiple tests. The coverage percentage and lines that were not covered by the test run will show in the output panel.
To see code coverage for your test, click the three-bars icon that’s next to your Org alias at the bottom of VS Code and open the class or trigger that you’re testing. Click the the three-bars icon to toggle between enabling and disabling code coverage highlighting.
A video walkthrough:
Do you prefer to review test coverage in the developer console or VS Code? Let me know in the comments!