Skip to main content
Prevent regressions by letting TestDriver run and repair itself on every change. Once you’ve explored, taught it your app, run it, validated outcomes, adapted to your UI, and learned to debug with screenshots, the last step is closing the loop: wire TestDriver into your pull requests so regressions never reach production. Your AI agent can run tests on every PR, investigate failures, and propose fixes — and you can drive all of it from GitHub itself, whether you’re at your desk or on your phone.

Use TestDriver in GitHub

TestDriver works directly in GitHub’s web interface and mobile app. The same MCP server that powers VS Code integration also works in GitHub, letting you create and manage tests from anywhere.

How It Works

When you add a TestDriver agent file to your repository at .github/agents/testdriver.agent.md, GitHub Copilot can use TestDriver’s MCP tools directly in:
  • GitHub.com (web browser)
  • GitHub Mobile app (iOS/Android)
  • Pull request conversations
  • Issue comments

Using TestDriver in GitHub Web

1

Navigate to Your Repository

Open your repository on GitHub.com. Make sure you have the TestDriver agent file at .github/agents/testdriver.agent.md.
2

Start a Copilot Chat

Click the Copilot icon in the GitHub interface to open a chat. You can find this in:
  • The repository’s Code tab
  • Pull request pages
  • Issue pages
3

Invoke the TestDriver Agent

Start your message with @testdriver:
The agent will spawn a sandbox environment and begin executing, just like in VS Code.
4

View Screenshots in Chat

As the test runs, screenshots appear directly in the chat. You can see what the AI sees and provide guidance if needed.

Creating Tests from PR Comments

You can create tests directly from pull request reviews. Comment on a PR and mention Copilot:
Copilot will:
  1. Use the TestDriver MCP server
  2. Create a test based on your description
  3. Commit the test file to the PR branch
This is useful for:
  • Adding test coverage during code review
  • Verifying bug fixes before merging
  • Creating regression tests for new features

Creating Tests from Issues

You can also create tests from issue comments:
The test will be created in a new branch and linked to the issue.

Mobile App Support

The GitHub Mobile app supports Copilot chat, which means you can use TestDriver from your phone:
  1. Open the GitHub app
  2. Navigate to your repository
  3. Tap the Copilot icon
  4. Type @testdriver followed by your request
Screenshots and test progress appear in the chat, letting you create and debug tests on the go.

Example: PR Review Workflow

Here’s a complete workflow for adding tests during code review:
1

Developer Opens PR

A developer opens a pull request with a new feature.
2

Reviewer Requests Tests

The reviewer comments:
3

Copilot Creates Tests

Copilot spawns TestDriver, creates the tests, and commits them to the PR branch.
4

Tests Run in CI

The new tests run automatically in CI, validating the feature works as expected.

Agent File Reference

The agent file at .github/agents/testdriver.agent.md contains the configuration for GitHub Copilot to use TestDriver. Here’s the structure:
The TD_API_KEY is pulled from your repository secrets when running in GitHub Actions or from your environment when using the web interface.
Make sure TD_API_KEY is set in your repository secrets for CI workflows. Go to Settings → Secrets and variables → Actions to add it.

Auto-Healing Tests

Auto-healing tests automatically fix themselves when your application changes. By integrating an AI coding agent with TestDriver in your CI pipeline, you can have AI investigate test failures and propose fixes. The example below uses GitHub Copilot in GitHub Actions, but the same approach works with any AI agent that can run TestDriver’s MCP server.

How It Works

When a test fails in CI:
  1. GitHub Actions detects the failure
  2. The AI agent spawns TestDriver with access to the MCP server
  3. The agent investigates by running the failing test and analyzing what changed
  4. The agent creates a fix by updating the test code
  5. A pull request is opened with the proposed changes for review

Setting Up Auto-Healing

1

Add Repository Secrets

Add your TestDriver API key to your repository secrets:
  1. Go to Settings → Secrets and variables → Actions
  2. Click New repository secret
  3. Add TD_API_KEY with your API key value
2

Create the Auto-Heal Workflow

Add a GitHub Actions workflow that triggers on test failures:
.github/workflows/auto-heal.yml
3

Configure Test Workflow

Make sure your main test workflow has a name that matches the workflows trigger:
.github/workflows/tests.yml

Example: Button Text Change

Here’s what auto-healing looks like when a button’s text changes:
1

Application Changes

A developer changes a button’s text from “Submit” to “Send”:
2

Test Fails

The test fails because it’s looking for the old text:
3

Auto-Heal Triggers

The auto-heal workflow runs, and the AI agent investigates:
4

PR Created

A pull request is opened with the fix:

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:
Configure the environment in Settings → Environments with required reviewers.

Limiting Changes

Add instructions to constrain what the AI can change:

Best Practices

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.
Tests with clear, semantic descriptions are easier for the AI to heal:
Configure GitHub notifications or Slack integration to be alerted when auto-heal PRs are created.
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
It may struggle with:
  • Major workflow changes
  • New features requiring new assertions
  • Complex multi-step interactions
For significant changes, create new tests by going back to Explore and generating them with the TestDriver agent.

View Your Runs

Open the TestDriver console to monitor test runs, healing PRs, and CI results across your projects.