GitHub CopilottestingTesting

Testing GitHub Copilot Instructions

GitHub Copilot instructions for testing: test generation, patterns, and coverage conventions.

.github/copilot-instructions.md
- Generate tests alongside implementation code; one test file per source file
- Write descriptive test names as complete sentences: "should return 404 when user not found"
- Generate both success and failure test cases for every function
- Use factory functions to create test fixtures; avoid duplicating setup code
- Apply the testing pyramid: generate more unit tests than integration tests
- Use MSW (Mock Service Worker) for HTTP mocking in frontend tests
- Generate test data with faker.js or Faker for realistic but fake values
- Include at least one edge case test (empty input, null, zero, max values)

How to use with GitHub Copilot

Create `.github/copilot-instructions.md` in your repository. GitHub Copilot uses these to customize suggestions across your whole repo.

#testing#copilot#github#unit-tests#coding-rules

Related Rules