How It Works
When a test fails in CI:- GitHub Actions detects the failure
- Copilot spawns the TestDriver agent with access to the MCP server
- The agent investigates by running the failing test and analyzing what changed
- Copilot creates a fix by updating the test code
- A pull request is opened with the proposed changes for review
Setting Up Auto-Healing
Add Repository Secrets
Add your TestDriver API key to your repository secrets:
- Go to Settings → Secrets and variables → Actions
- Click New repository secret
- Add
TD_API_KEYwith your API key value
Create the Auto-Heal Workflow
Add a GitHub Actions workflow that triggers on test failures:
.github/workflows/auto-heal.yml
Example: Button Text Change
Here’s what auto-healing looks like when a button’s text changes:Configuration Options
Selective Auto-Healing
You can limit auto-healing to specific test files or patterns:Manual Approval
For safety, you can require manual approval before auto-heal runs:Limiting Changes
Add instructions to constrain what the AI can change:Best Practices
Always review auto-heal PRs
Always review auto-heal PRs
Auto-heal is a tool, not a replacement for human judgment. Review all changes before merging to ensure the test still validates what you intended.
Use descriptive element descriptions
Use descriptive element descriptions
Tests with clear, semantic descriptions are easier for the AI to heal:
Set up notifications
Set up notifications
Configure GitHub notifications or Slack integration to be alerted when auto-heal PRs are created.
Track heal rate
Track heal rate
Monitor how often tests need healing. High heal rates may indicate:
- Tests are too brittle
- Application is changing rapidly
- Element descriptions need improvement
Limitations
Auto-healing works best for:- Element text changes
- Layout and styling updates
- Minor UI restructuring
- Major workflow changes
- New features requiring new assertions
- Complex multi-step interactions

