Deploy and Run Tests in the Command Line
This topic outlines how to use the Testing API directly in the command line with the Agentforce for Developers and Agentforce DX extensions.
See the Testing API workflow diagram for basic overview of how you can use the Testing API.
For guidance on creating a project or authorizing your org in VS Code, see Create Project.
Complete the required setup steps for the Testing API:
- Create an External Client App.
- Turn on Agents, and have at least one active Agent. The API name for Agentforce (Default) is
Copilot_for_Salesforce
.
For sample aiEvaluationDefinition XML, see Build Tests in Metadata API.
To deploy the test definition to your org in the CLI, use the project deploy start
command. For more information, see Salesforce CLI Command Reference.
You can also deploy your test case with the Command Palette using SFDX: Deploy This Source to Org
.
You can run tests in the command line with Agentforce DX using the agent test run
command. To run tests with Agentforce DX, you'll need the API name of the agent you want to test as well as your development org.
For more information on running tests via the CLI, see Run Agent Tests with Agentforce DX.
You can call Connect API endpoints via Agentforce DX with the api request rest
command.
Replace the runId in the example command to call the Get Test Results endpoint.