forcedotcom / salesforcedx-vscode

Salesforce Extensions for VS Code
https://developer.salesforce.com/tools/vscode
BSD 3-Clause "New" or "Revised" License
947 stars 404 forks source link

Starting SFDX: Run Apex Tests Cannot read property 'Name' of null #3235

Closed alinmocanuwork closed 3 years ago

alinmocanuwork commented 3 years ago

Summary

We cloned a sandbox on the summer preview. I try to run apex tests and for any test it fails

Steps To Reproduce:

  1. Run any apex test

Expected result

Show test coverage or failure reasons

Actual result

image

Additional information

VS Code Version:

image

SFDX CLI Version:

sfdx version sfdx-cli/7.100.0 win32-x64 node-v16.0.0

image

OS and version: Windows 10

AnanyaJha commented 3 years ago

Hi @alinmocanuwork thanks for reporting this! Have all the tests been deployed to the org already? And is this occurring when you run the test through the test sidebar, command palette commands, from the inline code actions, or all three?

alinmocanu commented 3 years ago

Hi, @AnanyaJha. This is happening for every test. In developer console it's fine. I tried all the options, me and other colleague and we have the same issue. This is happening only on the cloned org with the summer release preview enabled. In my older orgs with the same setup it's fine. So, clone a sandbox, try to connect to it with vs code and run some tests (which you know for sure are fine deployed).

AnanyaJha commented 3 years ago

Thanks @alinmocanu, we'll try repro-ing this with an org with the summer release preview enabled. If you all are familiar with the Salesforce CLI, could you try running your Apex tests via the CLI and post the output and the version of your CLI below?

$ sfdx plugins --core
$ sfdx force:apex:test:run --tests YourTests,YourTestsAgain --resultformat human --codecoverage
alinmocanu commented 3 years ago

First one image Second one image

AnanyaJha commented 3 years ago

Thank you @alinmocanu ! It looks like you're actually on a much older version of the CLI, if possible, could you update your plugins and run the same command again?

$ sfdx plugins:install salesforcedx
$ sfdx plugins --core
$ sfdx force:apex:test:run --tests YourTests,YourTestsAgain --resultformat human --codecoverage
alinmocanu commented 3 years ago

I tried 2 times, with sfdx update also, and it's not working. image

image

AnanyaJha commented 3 years ago

Hi @alinmocanu, sorry about all the set up changes, but do you mind updating to this specific version? We detected an unrelated issue with the last two versions so I'd like to confirm the behavior with a "clean" version.

$ sfdx plugins:install salesforcedx@51.11.0
$ sfdx plugins --core
$ sfdx force:apex:test:run --tests YourTests,YourTestsAgain --resultformat human --codecoverage
alinmocanu commented 3 years ago

image

Same error: ERROR running force:apex:test:run: Cannot read property 'Name' of null

AnanyaJha commented 3 years ago

Hi @alinmocanuwork sorry about the delay! I wanted to check in and see if you were still experiencing this issue?

alinmocanuwork commented 3 years ago

Hello @AnanyaJha Since then I worked on new sandboxes and I don't have that problem there. I think this was a bug on the salesforce environment, because of the release. It doesn't impact me anymore.