Skip to content

sf apex get test command returns 0% apex test coverage #2963

@kez-sophos

Description

@kez-sophos

Summary

sf apex get test command returns 0 totalCovered and 0 coveredPercent

Steps To Reproduce

  1. Authenticate to a scratch org
  2. Run apex test / tests

sf apex run test --json --result-format json --suite-names TEST_SUITE_NAME --target-org ORG --output-dir tests_run_scratch/ --wait 1

3, Get apex test result

sf apex get test --json --code-coverage --result-format json --target-org ORG --output-dir tests_run_scratch/ --test-run-id TEST_ID

can retrieve test id by running the query in the test org (AsyncApexJobId): SELECT Status, AsyncApexJobId FROM ApexTestRunResult

Expected result

apex get test command returns accurate line and percent, test coverage for apex classes

Actual result

apex get test command returns 0 line and percent, test coverage for apex classes

System Information

cmd.exe

{
  "architecture": "win32-x64",
  "cliVersion": "@salesforce/cli/2.50.6",
  "nodeVersion": "node-v20.15.0",
  "osVersion": "Windows_NT 10.0.22631",
  "rootPath": "C:\\Users\\<USER>\\AppData\\Local\\sf\\client\\2.50.6-6e9d7f7",
  "shell": "cmd.exe",
  "pluginVersions": [
    "@oclif/plugin-autocomplete 3.1.6 (core)",
    "@oclif/plugin-commands 4.0.6 (core)",
    "@oclif/plugin-help 6.2.5 (core)",
    "@oclif/plugin-not-found 3.2.10 (core)",
    "@oclif/plugin-plugins 5.3.4 (core)",
    "@oclif/plugin-search 1.2.2 (core)",
    "@oclif/plugin-update 4.4.7 (core)",
    "@oclif/plugin-version 2.2.6 (core)",
    "@oclif/plugin-warn-if-update-available 3.1.8 (core)",
    "@oclif/plugin-which 3.2.6 (core)",
    "@salesforce/cli 2.50.6 (core)",
    "apex 3.2.4 (core)",
    "auth 3.6.33 (core)",
    "community 3.2.22 (user) published 30 days ago (Sat Jun 22 2024)",
    "data 3.5.5 (core)",
    "deploy-retrieve 3.9.13 (core)",
    "dev 2.3.4 (user) published 37 days ago (Fri Jun 14 2024) (latest is 2.3.6)",
    "info 3.3.17 (core)",
    "limits 3.3.17 (core)",
    "marketplace 1.2.17 (core)",
    "org 4.3.6 (user) published 1 days ago (Sun Jul 21 2024)",
    "packaging 2.7.0 (core)",
    "schema 3.3.19 (core)",
    "settings 2.3.8 (core)",
    "sobject 1.4.19 (core)",
    "source 3.5.3 (core)",
    "telemetry 3.6.1 (core)",
    "templates 56.3.2 (core)",
    "trust 3.7.13 (core)",
    "user 3.5.17 (core)",
    "sfdx-git-delta 5.30.0 (user) published 243 days ago (Tue Nov 21 2023) (latest is 5.40.2)"
  ]
}

Additional information

image

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugIssue or pull request that identifies or fixes a bugvalidatedVersion information for this issue has been validated

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions