Lesson 5 of 5 Testing AI Solutions

Building a Strategy for Copilot-Generated Test Cases

This lesson explains how to use Copilot to generate test cases and how to manage the risks.

Learning outcomes

After completing this lesson, you will be able to:

  • Describe where Copilot helps in test design.
  • Explain the elements of a generation strategy.
  • Identify risks of generated tests and their mitigations.

Where Copilot helps

Copilot can generate test cases faster than people can write them. Given requirements, user stories, process descriptions or agent instructions, Microsoft 365 Copilot or GitHub Copilot can propose test scenarios, variations in phrasing, boundary values and negative cases. Copilot Studio agent evaluation can generate test conversations with AI. Copilot can also turn production transcripts and themes into test cases that reflect how users really ask questions, and generate synthetic test data that avoids real personal data.

The value is breadth: an agent should be tested with the many ways users phrase a request, not only the phrasing its designer expected, and Copilot is good at producing variations.

Building the strategy

A strategy for Copilot-generated tests defines inputs, generation, review and maintenance.

  • Inputs: give Copilot the requirements, acceptance criteria, agent instructions and examples of real questions, so that generated cases are grounded in what the agent must do.
  • Coverage targets: ask explicitly for typical, edge, negative, out-of-scope and adversarial cases, and for each persona and channel.
  • Expected results: each case needs an expected outcome or validation criteria; generated expectations must be checked against the requirements, because Copilot can misunderstand a rule.
  • Human review: a tester or business expert reviews generated cases before they enter the suite, removing duplicates and correcting expectations.
  • Format and storage: generate cases in the format the test tool imports, such as CSV for agent evaluation or the Copilot Studio Kit, and store them under version control with the solution.
  • Maintenance: regenerate or extend cases when requirements change, and add cases from production issues.

Risks to manage

Generated tests carry specific risks. The following table summarizes them with mitigations.

RiskMitigation
Expected results copy a misunderstanding of the requirementBusiness expert reviews expectations
Cases cluster on easy pathsRequest coverage categories explicitly; measure coverage by requirement
Real personal data from transcripts enters test filesUse synthetic data or mask before generation
Tests are generated by the same model family that runs the agent and share its blind spotsInclude human-written adversarial cases and red teaming
Worked example

Generating tests for a returns agent

A retailer's team must test a returns agent before a holiday peak. They have 12 hand-written test cases and two weeks. The returns policy has 15 rules, including exceptions for electronics and gift purchases. What strategy should you recommend?

The team should give Copilot the returns policy, the agent's instructions and anonymized examples of real customer messages, and ask for test cases per rule, with typical, boundary, negative and out-of-scope variations, including the electronics and gift exceptions and attempts to obtain refunds outside policy. Copilot formats them as CSV for agent evaluation or the Copilot Studio Kit. A returns specialist reviews the expected outcomes against the 15 rules, the team adds a few hand-written adversarial cases, and the suite is versioned with the agent and run before each release.

Check yourself

Why must experts review the expected results in Copilot-generated test cases?

Show answer

Copilot can misunderstand a rule, and a test that encodes that misunderstanding would pass wrong behaviour.

Exam Tips

Remember for the exam

  • Copilot generates test variations, boundary and negative cases, and synthetic data.
  • Ground generation in requirements, instructions and real (anonymized) questions.
  • Human experts review generated expectations before cases enter the suite.
  • Store generated cases in the test tool's format under version control.