---
description: Setup complete testing infrastructure
category: code-analysis-testing
---

# Setup Comprehensive Testing

Setup complete testing infrastructure

## Instructions

1. **Testing Strategy Analysis**
   - Analyze current project structure and identify testing needs
   - Determine appropriate testing frameworks based on technology stack
   - Define testing pyramid strategy (unit, integration, e2e, visual)
   - Plan test coverage goals and quality metrics
   - Assess existing testing infrastructure and gaps

2. **Unit Testing Framework Setup**
   - Install and configure primary testing framework (Jest, Vitest, pytest, etc.)
   - Set up test runner configuration and environment
   - Configure test file patterns and directory structure
   - Set up test utilities and helper functions
   - Configure mocking and stubbing capabilities

3. **Integration Testing Configuration**
   - Set up integration testing framework and tools
   - Configure test database and data seeding
   - Set up API testing with tools like Supertest or requests
   - Configure service integration testing
   - Set up component integration testing for frontend

4. **End-to-End Testing Setup**
   - Install and configure E2E testing framework (Playwright, Cypress, Selenium)
   - Set up test environment and browser configuration
   - Create page object models and test helpers
   - Configure test data management and cleanup
   - Set up cross-browser and device testing

5. **Visual Testing Integration**
   - Set up visual regression testing tools (Chromatic, Percy, Playwright)
   - Configure screenshot comparison and diff detection
   - Set up visual testing for different viewports and devices
   - Create visual test baselines and approval workflows
   - Configure visual testing in CI/CD pipeline

6. **Test Coverage and Reporting**
   - Configure code coverage collection and reporting
   - Set up coverage thresholds and quality gates
   - Configure test result reporting and visualization
   - Set up test performance monitoring
   - Configure test report generation and distribution

7. **Performance and Load Testing**
   - Set up performance testing framework (k6, Artillery, JMeter)
   - Configure load testing scenarios and benchmarks
   - Set up performance monitoring and alerting
   - Configure stress testing and capacity planning
   - Set up performance regression detection

8. **Test Data Management**
   - Set up test data factories and fixtures
   - Configure database seeding and cleanup
   - Set up test data isolation and parallel test execution
   - Configure test environment data management
   - Set up API mocking and service virtualization

9. **CI/CD Integration**
   - Configure automated test execution in CI/CD pipeline
   - Set up parallel test execution and optimization
   - Configure test result reporting and notifications
   - Set up test environment provisioning and cleanup
   - Configure deployment gates based on test results

10. **Testing Best Practices and Documentation**
    - Create comprehensive testing guidelines and standards
    - Set up test naming conventions and organization
    - Document testing workflows and procedures
    - Create testing templates and examples
    - Set up testing metrics and quality monitoring
    - Train team on testing best practices and tools