Salesforce CLI Command Reference
Release Notes
Deprecation Policy
apex get log
apex get test
apex list log
apex run
apex run test
apex tail log
Display test results for a specific asynchronous test run.
Provide a test run ID to display test results for an enqueued or completed asynchronous test run. The test run ID is displayed after running the “sf apex test run” command.
To see code coverage results, use the –code-coverage flag with –result-format. The output displays a high-level summary of the test run and the code coverage values for classes in your org. If you specify human-readable result format, use the –detailed-coverage flag to see detailed coverage results for each test method run.
force:apex:test:report
| Flag Name (Long) | Flag Name (Short) | Description |
|---|---|---|
‑‑api‑version | N/A | Type: Value Override the api version used for api requests made by this command |
‑‑code‑coverage | ‑c | Type: Boolean Retrieve code coverage results. |
‑‑concise | N/A | Type: Boolean Display only failed test results; works with human-readable output only. |
‑‑detailed‑coverage | N/A | Type: Boolean Display detailed code coverage per test. |
‑‑flags‑dir | N/A | Type: Value Import flag values from a directory. |
‑‑json | N/A | Type: Boolean Format output as json. |
‑‑output‑dir | ‑d | Type: Value Directory in which to store test result files. |
‑‑result‑format | ‑r | Type: Value Valid Values: human, tap, junit, jsonDefault value: humanFormat of the test results. |
‑‑target‑org | ‑o | Type: Value Required Username or alias of the target org. Not required if the target-org configuration variable is already set. |
‑‑test‑run‑id | ‑i | Type: Value Required ID of the test run. |
Display test results for your default org using a test run ID:
1sf apex get test --test-run-id <test run id>Similar to previous example, but output the result in JUnit format:
1sf apex get test --test-run-id <test run id> --result-format junitAlso retrieve code coverage results and output in JSON format:
1sf apex get test --test-run-id <test run id> --code-coverage --jsonSpecify a directory in which to save the test results from the org with the specified username (rather than your default org):
1sf apex get test --test-run-id <test run id> --code-coverage --output-dir <path to outputdir> --target-org me@myorg'