Run All Tests fails in namespaced scratch org
See original GitHub issueSummary
I’m developing on a managed package in a namespaced scratch org. When I try to run all of the Apex tests in a particular test class from the IDE with the “Run All Tests” link that appears at the top, it fails, saying “Unable to invoke any tests…This class name’s value is invalid.” Running a single test with the “Run Test” link above that specific method works fine. Running all the tests by doing “Invoke Apex Tests” from the command menu also works fine.
The problem appears to be that the namespace is prepended unnecessarily. If my namespace is “Test,” and my class is called “TestClass,” running all of the tests with the “Run All Tests” link produces a command like:
sfdx force:apex:test:run --tests Test.TestClass
When it fails, the error message says “This class name’s value is invalid: Test.Test,” which indicates that the namespace is being duplicated. If I modify the command to remove the namespace, as below, it works correctly:
sfdx force:apex:test:run --tests TestClass
The “Invoke Apex Tests” menu item appears to use a different flag, which produces this (also correct) command:
sfdx force:apex:test:run --classnames TestClass
Steps To Reproduce:
- Create a scratch org with a namespace
- Create an Apex test class with some tests
- Click the “Run All Tests” link that should appear in the editor above the class definition
Expected result
All tests in the class should run
Actual result
No tests run. An error message is returned about a missing class / invalid class name.
VS Code Version: 1.34.0
SFDX CLI Version: sfdx-cli/7.6.0-28071a499b darwin-x64 node-v10.15.3
OS and version: macOS Mojave 10.14.5
Issue Analytics
- State:
- Created 4 years ago
- Reactions:4
- Comments:19 (3 by maintainers)
Top GitHub Comments
Hello @lcampos, same over here. I found a workaround though, maybe you can try this too: Go to the Salesforce settings in VS Code and set the option salesforcedx-vscode-core.experimental.useApexLibrary to false.
Maybe this can tide you over until this is fixed.
Hi @NightBijou It helped me. Thanks!