Create an Agent Test from the Spec File
After you have a test spec file that you like, it’s time to actually create the test in your development org.
Before updating your development org with the new agent test, let’s first preview what it will look like when deployed to your org by generating a local AiEvaluationDefinition metadata XML file.
From VS Code’s integrated terminal, run this command:
If you’ve set a default org in your DX project, such as your sandbox, you don’t need to specify --target-org
. You can also run this command from your DX project using a terminal (macOS, Linux) or command prompt (Windows).
The command prompts you to enter an API name for the new test; be sure you specify a name that doesn’t already exist in your org. You’re then prompted to select the agent spec file from the ones available in your DX project.
When it finishes, the command makes a preview metadata XML file in the current directory for the new AiEvaluationDefinition component. This component represents an agent test in your org. The file is called <Test_Api_name>-preview-<timestamp>.xml
. If the file looks good to you, it’s time to create the agent test in your org.
Run the same command you used to preview the test, but don’t specify --preview
:
As with previewing, the command prompts you for the API name of your new test and the test spec file you want to use. If you prefer, you can also pass these values using the --spec
and --test-api-name
flags.
The command then displays the execution stages, such as creating local metadata and deploying to the development org. Once the command finishes executing, your org is updated with the new agent test. Your local DX project has also been synchronized with the associated metadata file (AiEvaluationDefinition) in the package directory.
To view the deployed test in the Testing Center UI of your development org, open the UI in a browser:
- Salesforce CLI Command Reference: agent Commands
- Salesforce Extensions for Visual Studio Code
- Salesforce Help: Agentforce Testing Center