Closed sgozansky closed 9 months ago
Hello @sgozansky :wave: It looks like you didn't include the full Salesforce CLI version information in your issue.
Please provide the output of version --verbose --json
for the CLI you're using (sf
or sfdx
).
A few more things to check:
rc
or nightly
versions. (docs)doctor
command to diagnose common issues.Thank you!
Thank you for filing this issue. We appreciate your feedback and will review the issue as soon as possible. Remember, however, that GitHub isn't a mechanism for receiving support under any agreement or SLA. If you require immediate assistance, contact Salesforce Customer Support.
the full sf version { "architecture": "darwin-arm64", "cliVersion": "@salesforce/cli/2.26.10", "nodeVersion": "node-v18.17.1", "osVersion": "Darwin 23.3.0", "rootPath": "/Users/sgozansky/.nvm/versions/node/v18.17.1/lib/node_modules/@salesforce/cli", "shell": "bash", "pluginVersions": [ "@oclif/plugin-autocomplete 3.0.5 (core)", "@oclif/plugin-commands 3.1.1 (core)", "@oclif/plugin-help 6.0.12 (core)", "@oclif/plugin-not-found 3.0.9 (core)", "@oclif/plugin-plugins 4.1.21 (core)", "@oclif/plugin-search 1.0.12 (core)", "@oclif/plugin-update 4.1.8 (core)", "@oclif/plugin-version 2.0.11 (core)", "@oclif/plugin-warn-if-update-available 3.0.9 (core)", "@oclif/plugin-which 3.0.15 (core)", "@salesforce/cli 2.26.10 (core)", "apex 3.0.20 (core)", "auth 3.3.3 (core)", "data 3.0.17 (core)", "deploy-retrieve 3.2.6 (core)", "info 3.0.18 (core)", "limits 3.1.5 (core)", "marketplace 1.0.18 (core)", "org 3.3.8 (core)", "packaging 2.1.7 (link) /Users/sgozansky/.nvm/versions/node/v18.17.1/lib/node_modules/@salesforce/plugin-packaging", "schema 3.1.0 (core)", "settings 2.0.19 (core)", "sobject 1.1.3 (core)", "source 3.1.6 (core)", "telemetry 3.1.10 (core)", "templates 56.0.11 (core)", "trust 3.3.2 (core)", "user 3.2.4 (core)" ] }
Hello @sgozansky :wave: None of the versions of sf
you shared match the latest release.
Shared: 2.26.10
, 2.26.10
Latest: 2.27.6
Update to the latest version of Salesforce CLI (docs) and confirm that you're still seeing your issue.
You can also try the rc
and nightly
releases! (docs)
After updating, share the full output of sf version --verbose --json
I tried with { "architecture": "darwin-arm64", "cliVersion": "@salesforce/cli/2.29.0", "nodeVersion": "node-v18.17.1", "osVersion": "Darwin 23.3.0", "rootPath": "/Users/sgozansky/.nvm/versions/node/v18.17.1/lib/node_modules/@salesforce/cli", "shell": "bash", "pluginVersions": [ "@oclif/plugin-autocomplete 3.0.7 (core)", "@oclif/plugin-commands 3.1.2 (core)", "@oclif/plugin-help 6.0.12 (core)", "@oclif/plugin-not-found 3.0.10 (core)", "@oclif/plugin-plugins 4.2.1 (core)", "@oclif/plugin-search 1.0.13 (core)", "@oclif/plugin-update 4.1.10 (core)", "@oclif/plugin-version 2.0.12 (core)", "@oclif/plugin-warn-if-update-available 3.0.10 (core)", "@oclif/plugin-which 3.0.15 (core)", "@salesforce/cli 2.29.0 (core)", "apex 3.0.22 (core)", "auth 3.3.11 (core)", "data 3.0.19 (core)", "deploy-retrieve 3.2.11 (core)", "info 3.0.21 (core)", "limits 3.1.7 (core)", "marketplace 1.0.20 (core)", "org 3.3.11 (core)", "packaging 2.1.7 (link) /Users/sgozansky/.nvm/versions/node/v18.17.1/lib/node_modules/@salesforce/plugin-packaging", "schema 3.1.1 (core)", "settings 2.0.22 (core)", "sobject 1.1.9 (core)", "source 3.1.10 (core)", "telemetry 3.1.11 (core)", "templates 56.0.13 (core)", "trust 3.3.6 (core)", "user 3.2.7 (core)" ] } same issue
sf apex run test --tests -ycv --result-format json
--tests should specify the tests afterward (by name). And then use -y -c -v for your other flags. see sf apex run test --help for syntax and examples
what kind of package is this? Managed or unlocked?
If, as I suspect, that wasn't the real command you entered, then try a few things
sf org list metadata -m ApexClass
to get what the server thinks the name of the classes areI added a test, but I didn't write it here. I use manage package.
{
"result": {
"summary": {
"outcome": "Passed",
"testsRan": 2,
"passing": 2,
"failing": 0,
"skipped": 0,
"passRate": "100%",
"failRate": "0%",
"testStartTime": "2024-02-08T16:24:39.953Z",
"testExecutionTime": "16634 ms",
"testTotalTime": "16634 ms",
"commandTime": "0 ms",
"hostname": "<host name>",
"orgId": "<org id>",
"username": "<host name>",
"testRunId": "",
"testRunCoverage": "0%",
"orgWideCoverage": "0%"
},
"tests": [
{
"Id": "",
"QueueItemId": "",
"StackTrace": "",
"Message": "",
"AsyncApexJobId": "",
"MethodName": "testAB",
"Outcome": "Pass",
"ApexClass": {
"Id": "01p0300000BHdlGAAT",
"Name": "ut_ApexLimits",
"NamespacePrefix": "FSL"
},
"RunTime": 2511,
"FullName": "FSL.ut_ApexLimits.testAB"
},
{
"Id": "",
"QueueItemId": "",
"StackTrace": "",
"Message": "",
"AsyncApexJobId": "",
"MethodName": "testSchedule",
"Outcome": "Pass",
"ApexClass": {
"Id": "01p0300000BHdlGAAT",
"Name": "ut_ApexLimits",
"NamespacePrefix": "FSL"
},
"RunTime": 3657,
"FullName": "FSL.ut_ApexLimits.testSchedule"
}
],
"coverage": {
"coverage": [],
"records": [],
"summary": {
"totalLines": 0,
"coveredLines": 0,
"orgWideCoverage": "0%",
"testRunCoverage": "0%"
}
}
}
}
I can give you an org to try. and another question - in this case the two tests pass, but if one of them fails does the the run still calculate coverage?
I also tried to get the coverage info using this SOQL sf data query -t --query "SELECT ApexClassOrTrigger.Name, NumLinesCovered, NumLinesUncovered FROM ApexCodeCoverageAggregate"
.
But nothing - I am not sure it is supposed to work.
@sgozansky After discussing this with a few colleagues internally, it seems that tests from managed packages don't report code coverage since orgs don't have control over the code coverage of all their installed packages.
Thanks for the info.
@mdonnalley is this something that was supported in SFDX
?
I know I can do it with ant
in the deployment and testing phase but it's lacking a lot of information.
Is there anything you can think that will help me gather coverage information about my MP and not just 75% threshold?
Hi working on mac M1 - @salesforce/cli/2.26.10 darwin-arm64 node-v18.17.1
running > sf apex run test --tests -ycv --result-format json on test from deployed package.
receiving results without coverage status:
"coverage": { "coverage": [], "records": [], "summary": { "totalLines": 0, "coveredLines": 0, "orgWideCoverage": "0%", "testRunCoverage": "0%" } Any idea why there isn't any coverage information?