8

In user setting.JSON I am using

{
    "salesforcedx-vscode-apex.java.home":"C:\\Program Files\\Java\\jdk1.8.0_131",
    "salesforcedx-vscode-core.show-cli-success-msg": true,
    "salesforcedx-vscode-core.retrieve-test-code-coverage": true
}

in workspace setting I am using

{
  "salesforcedx-vscode-core.push-or-deploy-on-save.enabled": true,
  "search.exclude": {
    "**/node_modules": true,
    "**/bower_components": true,
    "**/.sfdx": true
  },
  "eslint.nodePath": "c:\\Users\\e3027618\\.vscode\\extensions\\salesforce.salesforcedx-vscode-lwc-45.13.0\\node_modules",
  "salesforcedx-vscode-core.show-cli-success-msg": true,
  "salesforcedx-vscode-core.retrieve-test-code-coverage": true
}

But Still I am getting the below error message:

No code coverage information was found for test run 7070U00000r8Ny3. Set "salesforcedx-vscode-core.retrieve-test-code-coverage": true in your user or workspace settings, then run Apex tests from the Apex Tests sidebar or using the Run Tests or Run All Tests code lens within a test class file.

1

4 Answers 4

6

I was having a similar issue. I'd added "salesforcedx-vscode-core.retrieve-test-code-coverage": true into the user "settings.json" as instructed.

Yet the error message about "No code coverage information" was still appearing.

When I checked the Apex tests side bar there weren't any tests displayed to run.

enter image description here

Attempting to use the green Run Tests button there gave an error about configuring the Apex Language Server. Something had gone wrong with my "salesforcedx-vscode-apex.java.home" setting. After correcting that (See Activate the Apex Language Server) and restarting vscode the Apex Language Server started. And accessing the Apex tests side bar showed all the existing test cases.

When I ran them the coverage was now available.

enter image description here

4

Probably the issue might be with the Apex test execution option set in your org. Please ensure 'Store only Aggregated Code Coverage' is not checked.

I faced the same issue and it helped me.

The discussion thread where I found the solution. https://github.com/forcedotcom/salesforcedx-vscode/issues/1262

1
  • 1
    thx man! this was very helpful Commented Apr 5, 2022 at 16:51
3

Do exactly as the error says and add salesforcedx-vscode-core.retrieve-test-code-coverage to your workspace settings:

{
    "salesforcedx-vscode-apex.java.home":"C:\\Program Files\\Java\\jdk1.8.0_131",
    "salesforcedx-vscode-core.show-cli-success-msg": true,
    "salesforcedx-vscode-core.retrieve-test-code-coverage": true
}
3
  • Thank you so much for responding Brian, I have updated as you said and I have updated my question as well but still, the error is still the same.
    – gs650x
    Commented May 7, 2019 at 12:40
  • I believe when you run the actual test, you have to set a parameter that saves the code coverage. Look through the sfdx docs for running apex tests Commented May 7, 2019 at 13:56
  • 1
    I have got the this documentation forcedotcom.github.io/salesforcedx-vscode/articles/apex/testing and I am doing exactly what is written but it is not helpful at all
    – gs650x
    Commented May 7, 2019 at 14:06
0

You can see code coverage by installing the plugin named Coverage Gutters: Once you've installed it reload VS Code (Close -> Re-Open editor)

  • Open the Apex class you want to see code coverage for and on the bottom side of your VS Code screen you'll see a small button named Watch(click once - it will display a warning message, please ignore it): enter image description here

  • Re-run your test and come back to your Apex class but now click on the 3 line menu on the right-hand side of the Watch button enter image description here

Now you should see your code coverage as bellow: enter image description here

Hope this proves useful for you!

You must log in to answer this question.

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