Testing Documentation
This section provides comprehensive documentation for testing SegnoMMS, including test organization, best practices, and available utilities.
- Test Suite Organization
- Unit Tests (tests/unit/)
- Integration Tests (tests/integration/)
- Structural Tests (tests/structural/)
- Visual Regression Tests (tests/visual/)
- Performance Tests (tests/perf/)
- Test Helpers and Utilities (tests/helpers/)
- Test Fixtures (tests/fixtures/)
- Test Configuration (conftest.py)
- Continuous Integration
- Local Development Testing
- Troubleshooting Common Issues
- Using Constants
- Visual Regression Testing
- Testing Best Practices
- Development Testing Principles
- Type-Safe Testing with Constants
- Error Handling Testing
- Visual Regression Testing Guidelines
- Performance Testing Practices
- Test Organization Best Practices
- Contributing Test Guidelines
- Test Naming Conventions
- Debugging Failed Tests
- Testing Environment Setup
- Quality Metrics and Goals
Overview
The SegnoMMS test suite is organized into multiple categories for systematic validation of all functionality:
Unit tests - Test individual components in isolation
Integration tests - Test component interaction and end-to-end workflows
Structural tests - SVG structure and format validation
Visual regression tests - Visual output validation and QR functionality
Performance tests - Benchmarks and profiling
Quick Start
Run All Tests
# Comprehensive test suite (recommended for CI/CD)
make test
# All tests including strict type checking
make test-all
# Quick development testing (unit tests only)
make test-quick
Run Specific Test Categories
# Individual test categories
make test-unit # Unit tests
make test-integration # Integration tests
make test-structural # SVG structure validation
make test-visual # Visual regression tests
make test-performance # Performance benchmarks
# All test categories (no linting/docs)
make test-all-categories
Performance Benchmarking
# Comprehensive performance testing
make benchmark # Full benchmark suite
make benchmark-quick # Quick benchmarks
make benchmark-memory # Memory profiling
make benchmark-report # Generate performance report
Test Directory Structure
tests/
├── unit/ # Unit tests for individual components
├── integration/ # Integration tests for component interaction
├── structural/ # SVG structure and format validation
├── visual/ # Visual regression and QR functionality tests
├── perf/ # Performance benchmarks and profiling
├── helpers/ # Test utilities and custom assertions
├── fixtures/ # Test data and configuration fixtures
└── conftest.py # Pytest configuration and shared fixtures
Development Testing Best Practices
Use Constants: Import from
segnomms.constantsinstead of string literals for better maintainabilityFollow Naming Conventions: Use descriptive test names that explain the expected behavior
Test Edge Cases: Include boundary conditions and error scenarios
Mock External Dependencies: Isolate unit tests from external systems
Validate Visual Output: Use visual regression tests for shape and rendering changes
Performance Regression: Run benchmarks for performance-sensitive changes
For detailed information, see the individual testing documentation sections.