GitHub Copilot is the most widely adopted AI coding assistant in the industry, and for many QA teams it's the single biggest productivity gain available today. Built by GitHub and Microsoft and powered by OpenAI models, it lives inside your editor and turns half-typed comments and test names into working code. Once you learn how it thinks, writing tests stops feeling like typing and starts feeling like editing.
Where Copilot runs
Copilot is an IDE plugin. It supports VS Code, all JetBrains IDEs (IntelliJ, WebStorm, PyCharm), Visual Studio, Vim, Neovim, and a handful of others. The experience is consistent: ghost-text suggestions appear inline as you type; you accept with Tab, dismiss with Esc.
How it helps for test code
Copilot is at its strongest in test files because tests are repetitive, pattern-heavy, and benefit from your file's existing context.
- Autocomplete. Type a test name and a comment; Copilot proposes the body.
- Test-case suggestions. Once you've written one or two tests, Copilot starts proposing the next ones in the same style.
- Assertion generation. Given the function under test, it suggests
expect(...)calls that often line up with what the function actually returns. - Test data. Synthetic emails, names, addresses, IDs — it generates passable fixtures in any format your file already uses.
A practical Playwright + TypeScript example
You write the test name and a comment. Copilot fills in the body:
// You type the test name and a comment
test('login with invalid credentials shows error', async ({ page }) => {
// Copilot suggests:
await page.goto('/login');
await page.getByLabel('Email').fill('wrong@test.com');
await page.getByLabel('Password').fill('wrongpass');
await page.getByRole('button', { name: 'Sign in' }).click();
await expect(page.getByText('Invalid credentials')).toBeVisible();
});The accuracy of that output depends entirely on the context Copilot can see — open files, the project's existing tests, and the comment you wrote. Better context, better output.
The Copilot loop
Step 1 of 4
Write a descriptive comment or test name
State the intent in plain English. The more specific the comment, the better the suggestion that follows.
Tips for better suggestions
- Descriptive test names.
test('cart total updates when item quantity changes')triggers far better suggestions thantest('test1'). - Comments first. Write the intent before the code. Copilot extends what you've stated, not what you might be thinking.
- Consistent patterns. Copilot mirrors what your file already does. If your test uses Page Object Model, suggestions will use POM. If your file imports
getByTestId, suggestions will usegetByTestId. - Keep relevant files open. Copilot considers open editor tabs as context. Have your
LoginPage.ts, yourtest-utils.ts, your existing spec for similar features open at the same time.
Generating Page Objects
A common pattern: write the class name and a one-line spec, let Copilot fill it in.
// Page object for the checkout page with methods to fill payment, select shipping, place order
export class CheckoutPage {
// Copilot generates the constructor, locators, and methods
}Output quality on this scales with how much of your existing POM style is visible — open one of your existing page objects in another tab and the result will follow the same conventions.
Copilot Chat
Copilot Chat is the newer, more capable interface — a chat panel inside the IDE. Slash commands shortcut common operations:
/explain— explains the highlighted code in plain English. Useful for unfamiliar tests written by someone else./fix— proposes a fix for the current error or selected code./tests— generates tests for the function you have selected. Great for unit-test scaffolding./doc— generates a JSDoc / TSDoc block for the selected symbol.
Chat is also where you ask questions that span multiple files: "Where do we currently handle expired session redirects?" or "What patterns does our codebase use for waiting on async UI?"
Limitations to internalise
- Suggestions can be wrong. Confidently wrong, sometimes. Especially for unusual patterns Copilot hasn't seen.
- Hallucinated APIs. Calls to methods that don't exist on the libraries you're using. Always run the test before merging.
- Doesn't know your codebase out of the box. It works from open files. If your project's conventions live in files you haven't opened, Copilot won't follow them.
- Best-of-three quality. Treat the first suggestion as a draft. Sometimes pressing
Alt+]to cycle through alternatives gets you something closer to what you wanted. - ALWAYS REVIEW. This is the rule. Generated tests are hypotheses until a human has read them.
Pricing
- Copilot Individual: $10/user/month.
- Copilot Business: $19/user/month — adds policy controls and IP indemnity.
- Copilot Enterprise: higher tier with more org-level controls and customisation.
For most QA teams, Business is the right tier — the IP indemnity matters when AI-generated code ships to production.
For deeper test patterns Copilot generates well from, see the Cypress with TypeScript and Playwright with TypeScript courses on this site.
⚠️ Common Mistakes
- Accepting the first suggestion blindly. Copilot is a strong starting point and a poor finishing point. Read every suggestion before accepting.
- Using vague test names.
test('it works')produces vague code. The test name is the prompt. - Closing all your existing files. Copilot's context window is limited; closed files don't help. Keep representative examples open while authoring.
- Forgetting to run the generated test. Hallucinated APIs only show up at runtime. A test that looks right but doesn't run isn't a test.
🎯 Practice Task
45 minutes. Requires a Copilot subscription (free trial available).
- Pick a real feature in a project you have code for — login, checkout, search.
- Create a new spec file. Write only the test name and a one-line comment.
- Accept Copilot's suggestion. Read it carefully. Mark which lines look correct, which look wrong.
- Run the test. Note any hallucinated APIs or wrong assertions.
- Compare: how much of the test was usable as-is, vs how much you had to fix? That ratio is your starting baseline.
Next lesson: AI-native IDEs like Cursor that take this further.