Skip to main content

Time Estimate

Use AI to Generate Tests

Learning Objectives

After completing this unit, you’ll be able to:

  • Use AI to generate test cases.
  • Execute batch testing in Agentforce Studio Tests.

Let AI Generate Your Tests

Manually creating a diverse and scalable set of test scenarios is time-consuming and complex. The Agentforce Studio Tests has the solution. You can now use AI to effortlessly generate hundreds of synthetic interactions based on the agent’s subagents and actions to be used as test cases. This helps ensure that your agents handle various customer interactions accurately.

Then you run those tests automatically in parallel to see what subagents and actions the agent chooses. From there, you can iterate by adjusting agent instructions and guardrails as needed—saving time that would have been lost on manually testing many different variations of a conversation. The result is a faster time to testing and a faster time to a more trusted agent that you feel confident deploying.

A good-quality test case dataset has three quality attributes.

  • Volume: A sufficient number of test cases to ensure comprehensive coverage of different scenarios and edge cases.
  • Diversity: A wide range of inputs, contexts, and variations to test the AI agent’s adaptability across real-world use cases.
  • Quality: Well-defined, accurate, and relevant test cases aligned with the AI agent’s objectives.

To complete this unit, you’ll need to use the special Developer Edition org you created in the last unit. When you’re finished following the step-by-step instructions, click Check Challenge to Earn 500 Points at the bottom of the page.

Note

Important!

  • Running tests consumes requests and credits. See Considerations for Testing Center.
  • Testing agents can modify CRM data. To avoid issues, be sure to use the Agentforce Testing Center only in your sandbox environment.

Batch Testing

In the last unit you used the Agentforce Testing Center. In this unit you’ll use Agentforce Studio to generate tests with AI.

  1. From the App Launcher App Launcher icon, search for and select Agentforce Studio.
  2. Click Tests.
  3. Click New Suite.
  4. For Test Name, enter Generated Test Agentforce v1.
  5. Select Einstein Copilot - 1 or Agentforce (Default) - 1.
  6. For Description, enter Test cases for Agentforce to verify account summaries and details.
  7. Click Next.
  8. Click Next.
  9. Select Generate Test Cases.
  10. For Number of test cases, leave it at 20.
  11. For Test Case Description, enter Generate realistic inquiries that customers might ask about their user account, orders, and other general questions about products. This is also where you can define the number of these test cases that are positive and negative to create diversity in your test cases.
  12. For Generate Test Cases From, select the Subagents and Actions assigned to the agent.
  13. Click Next.
  14. Click Generate Test Cases.
    Wait for the test to be generated. You may have to refresh your browser as it may take a bit to generate the tests.

    Agentforce Studio with Test cases and Run Test button.
  1. Click Run Test.

    Tests with Agent Response showing Generating.

Once the tests are created, you can download them to make sure the agent is doing what you want it to do. You can also fine-tune the agent as needed. In the next unit, you take a closer look at the test results and use Agentforce Builder to troubleshoot a test.

Make sure to click Check Challenge to Earn 500 Points before moving on to the next unit.

Resources

Share your Trailhead feedback over on Salesforce Help.

We'd love to hear about your experience with Trailhead - you can now access the new feedback form anytime from the Salesforce Help site.

Learn More Continue to Share Feedback