Skip to content
Agents tracked: 258 Downloads (7d): 219M up 6.1% GitHub stars: 5.5M VS Code installs: 148M Releases (7d): 293 Agent pull requests (last week): 937K Updated Oct 7, 2026
Recipe

Generate unit and integration tests with GitHub Copilot

GitHub's tutorial uses Copilot Chat to write a unit test suite for a class, then integration tests that mock an external notification service, and then asks what coverage is still missing.

The problem

Tests for legacy or fast-moving code often never get written. An agent can quickly draft edge-case and mock-heavy tests, leaving developers to review them and fill gaps.

Steps

  1. Open the file you want to test and start Copilot Chat in your IDE.
  2. Use the /tests slash command, or write a detailed prompt that lists scenarios, edge cases and error handling.
  3. For integration tests, ask Copilot to mock external services such as a notification system.
  4. Keep existing test files open in nearby tabs so Copilot follows your testing patterns.
  5. Run the suite, then ask Copilot which tests are still missing and add them.

From the official docs

/tests

Results

  • A unit test suite that covers edge cases, exceptions and data validation.
  • Integration tests that check mocked services with assertions such as assert_called_once_with().
  • A list of further tests needed to fill coverage gaps.

As reported by the source (GitHub Docs); AgentGid did not measure these figures.

Takeaway. Ask for edge cases and mocks explicitly, then ask the agent what it missed.
AgentGid's take

This suits any developer already working in an IDE with Copilot, since the recipe needs only Copilot Chat, an existing test file for style, and a codebase you can review. Watch the credit pool: chat and agent mode draw on monthly GitHub AI Credits (Pro has 1,500), so big suites could use them up. Zed is open source, with a free Personal plan.

The agent used here

Similar use cases

Guides