agent test results
Get the results of a completed agent test run.
This command requires a job ID, which the original “agent test run” command displays when it completes. You can also use the –use-most-recent flag to see results for the most recently run agent test.
By default, this command outputs test results in human-readable tables for each test case. The tables show whether the test case passed, the expected and actual values, the test score, how long the test took, and more. Use the –result-format to display the test results in JSON or Junit format. Use the –output-dir flag to write the results to a file rather than to the terminal.
| 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 |
‑‑flags‑dir | N/A | Type: Value Import flag values from a directory. |
‑‑job‑id | ‑i | Type: Value Required Job ID of the completed agent test run. |
‑‑json | N/A | Type: Boolean Format output as json. |
‑‑output‑dir | ‑d | Type: Value Directory to write the agent test results into. If the agent test run completes, write the results to the specified directory. If the test is still running, the test results aren’t written. |
‑‑result‑format | N/A | Type: Value Valid Values: json, human, junit, tapDefault value: humanFormat of the agent test run 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‑runner | N/A | Type: Value Valid Values: agentforce-studio, testing-centerExplicitly specify which test runner to use (agentforce-studio or testing-center). By default, the command automatically detects which test runner to use based on the test definition metadata type in your org. Use this flag to explicitly specify the runner type. ‘agentforce-studio’ uses AiTestingDefinition metadata. ‘testing-center’ uses AiEvaluationDefinition metadata. |
‑‑verbose | N/A | Type: Boolean Show generated data in the test results output. When enabled, includes detailed generated data (such as invoked actions) in the human-readable test results output. This is useful for debugging test failures and understanding what actions were actually invoked during the test run. The generated data is in JSON format and includes the Apex classes or Flows that were invoked, the Salesforce objects that were touched, and so on. Use the JSON structure of this information to build the test case JSONPath expression when using custom evaluations. |
Get the results of an agent test run in your default org using its job ID:
Get the results of the most recently run agent test in an org with alias “my-org”:
Get the results of the most recently run agent test in your default org, and write the JSON-formatted results into a directory called “test-results”: