with one click
testing-patterns
Testing strategies and patterns for quality assurance
Install with Codex or Claude Copy this prompt, paste it into Codex, Claude, or another assistant, and let it review the skill page and install it for you.
Menu
Testing strategies and patterns for quality assurance
Install with Codex or Claude Copy this prompt, paste it into Codex, Claude, or another assistant, and let it review the skill page and install it for you.
Based on SOC occupation classification
Pull request lifecycle domain knowledge — branch strategy detection, PR size classification, confidence-scored review, git-aware context, PR analytics, dependency management, and split/merge/describe operations.
Production readiness audit domains, weighted scoring criteria, and check specifications for the /preflight workflow.
Application scaffolding orchestrator. Creates full-stack applications from requirements, selects tech stack, coordinates agents.
Production deployment workflows, rollback strategies, and CI/CD best practices.
Internationalization and localization patterns for multi-language applications
Mobile UI/UX patterns for iOS and Android. Touch-first, platform-respectful design with React Native/Expo focus.
| name | testing-patterns |
| description | Testing strategies and patterns for quality assurance |
| triggers | ["context","test","tdd","jest","vitest"] |
Purpose: Apply professional testing strategies for quality assurance
This skill provides comprehensive testing patterns for unit, integration, and end-to-end testing.
/\
/E2E\ ← Few, slow, expensive
/──────\
/Integra-\ ← Some, medium speed
/ tion \
/────────────\
/ Unit \ ← Many, fast, cheap
/────────────────\
describe("UserService", () => {
it("should create a user with valid data", async () => {
// Arrange
const userData = { email: "test@example.com", name: "Test" };
const mockRepository = {
create: jest.fn().mockResolvedValue({ id: "1", ...userData }),
};
const service = new UserService(mockRepository);
// Act
const result = await service.createUser(userData);
// Assert
expect(result.id).toBe("1");
expect(result.email).toBe("test@example.com");
expect(mockRepository.create).toHaveBeenCalledWith(userData);
});
});
// Pattern: should_[expected]_when_[condition]
it('should throw ValidationError when email is invalid', () => { ... });
it('should return empty array when no users exist', () => { ... });
it('should hash password when creating user', () => { ... });
describe("POST /api/users", () => {
beforeAll(async () => {
await setupTestDatabase();
});
afterAll(async () => {
await teardownTestDatabase();
});
it("should create user and return 201", async () => {
const response = await request(app)
.post("/api/users")
.send({ email: "test@example.com", password: "SecurePass123!" })
.expect(201);
expect(response.body.data.email).toBe("test@example.com");
});
});
const mockSendEmail = jest.fn().mockResolvedValue({ sent: true });
jest.mock("./emailService", () => ({
sendEmail: jest.fn().mockResolvedValue({ sent: true }),
}));
const spy = jest.spyOn(userService, "validate");
await userService.createUser(data);
expect(spy).toHaveBeenCalled();
| Metric | Target |
|---|---|
| Lines | ≥80% |
| Branches | ≥75% |
| Functions | ≥80% |
| Statements | ≥80% |
| Pattern | Usage |
|---|---|
| AAA | All unit tests |
| Given-When-Then | BDD style |
| Mocking | Isolate dependencies |
| Fixtures | Reusable test data |
| Factories | Generate test objects |
| Snapshot | UI components |