test-auto
Test Automation
Create comprehensive test suites following the testing pyramid.
When to Use
- Setting up tests for new code
- User asks to "add tests" or "improve coverage"
- Before refactoring (add tests first)
- Implementing CI/CD test pipelines
Testing Pyramid
/\ E2E (few, critical paths)
/ \ Integration (moderate)
/____\ Unit (many, fast)
Test Structure
Unit Tests
- Test individual functions/methods
- Mock external dependencies
- Fast execution (<100ms per test)
- High coverage (>80%)
Integration Tests
- Test component interactions
- Use test databases/containers
- Moderate execution time
- Cover critical integrations
E2E Tests
- Test complete user flows
- Use Playwright/Cypress
- Slowest execution
- Cover happy paths only
Test Patterns
// Arrange-Act-Assert
describe("UserService", () => {
it("should create user with valid data", async () => {
// Arrange
const userData = { name: "Test", email: "test@example.com" };
// Act
const result = await userService.create(userData);
// Assert
expect(result.id).toBeDefined();
expect(result.name).toBe("Test");
});
});
Output
- Test files with clear naming
- Mock/stub implementations
- Test data factories
- Coverage configuration
- CI pipeline integration
Examples
Input: "Add tests for the auth module" Action: Analyze auth module, create unit tests for functions, integration tests for flows
Input: "Set up testing for this project" Action: Detect framework, configure test runner, create example tests, add CI config
More from htlin222/dotfiles
cpp
Write modern C++ with RAII, smart pointers, and STL. Use for C++ development, memory safety, or performance optimization.
130refactor
Refactor code for quality and maintainability. Use for cleanup and tech debt reduction.
76data-science
Data analysis, SQL queries, BigQuery operations, and data insights. Use for data analysis tasks and queries.
52c-lang
Write efficient C code with proper memory management and system calls. Use for C optimization, memory issues, or system programming.
46quarto-book
Generate Quarto Book project structure with chapters, configuration, and output settings. Use when user wants to create a book, multi-chapter document, technical manual, or asks about Quarto book setup.
45scientific-figure-assembly
Assemble multi-panel scientific figures with panel labels (A, B, C) at publication quality (300 DPI) using R. Use when combining individual plots into journal-ready figures.
43