Prompt file imported from danilonovaisv/PROMPT-APP (
.windsurf/workflows/tests.md). Copyright stays with the author.
/tests - Comprehensive Testing System
Manage, run, and analyze all tests across the MAx Framework with comprehensive reporting and debugging capabilities.
Usage
# Run all tests with comprehensive reporting
/tests
# Run specific test category
/tests --category unit
/tests --category integration
/tests --category system
# Run tests with specific focus
/tests --focus contracts
/tests --focus commands
/tests --focus quality
# Run tests with detailed output
/tests --verbose
# Run tests with auto-fix enabled
/tests --auto-fix
# Generate test report
/tests --report
# Quick test run
/tests --quick
Test Categories
๐งช Unit Tests
- Individual component testing
- Function and method validation
- Class and module testing
- Edge case coverage
๐ Integration Tests
- Component interaction testing
- Cross-module functionality
- API integration validation
- Workflow testing
๐๏ธ System Tests
- End-to-end workflows
- Framework integration
- Performance validation
- User scenario testing
๐ Contract Tests
- AI contract validation
- Code quality standards
- Performance contracts
- Security contracts
Test Focus Areas
๐ฏ Contracts Focus
/tests --focus contracts
- AI contract compliance
- Code quality standards
- Performance benchmarks
- Security validations
โก Commands Focus
/tests --focus commands
- Command execution testing
- Argument parsing validation
- Error handling verification
- Integration testing
๐ Quality Focus
/tests --focus quality
- Code quality metrics
- Style guide compliance
- Documentation coverage
- Best practices validation
Test Execution Options
๐ Comprehensive Mode
/tests
- All test categories
- Detailed reporting
- Performance metrics
- Coverage analysis
- Error categorization
โก Quick Mode
/tests --quick
- Essential tests only
- Minimal output
- Fast execution
- Basic reporting
๐ง Auto-Fix Mode
/tests --auto-fix
- Automatic error fixing
- Import resolution
- Syntax correction
- Missing method addition
๐ Report Mode
/tests --report
- Detailed test report
- Coverage statistics
- Performance analysis
- Trend tracking
Test Discovery
๐ Test File Patterns
test_*.py- Unit test files*_test.py- Alternative test namingtests/**/*.py- Test directory structure**/test_*.py- Recursive discovery
๐ Test Directory Structure
tests/
โโโ unit/ # Unit tests
โ โโโ test_commands.py
โ โโโ test_quality.py
โ โโโ test_contracts.py
โโโ integration/ # Integration tests
โ โโโ test_workflows.py
โ โโโ test_systems.py
โ โโโ test_apis.py
โโโ system/ # System tests
โ โโโ test_end_to_end.py
โ โโโ test_performance.py
โ โโโ test_user_scenarios.py
โโโ reports/ # Test reports
โโโ coverage.json
โโโ results.json
โโโ trends.json
Test Results
๐ Success Metrics
โ
PASSED: 42 tests (85%)
โ ๏ธ SKIPPED: 5 tests (10%)
โ FAILED: 3 tests (5%)
โฑ๏ธ Duration: 2.34s
๐ Coverage: 87.3%
๐จ Failure Analysis
โ FAILED TESTS:
1. test_command_execution
- Error: AssertionError
- Location: tests/commands/test_commands.py:42
- Message: Expected success but got error
2. test_contract_validation
- Error: ImportError
- Location: tests/contracts/test_ai.py:15
- Message: Missing required import
3. test_quality_metrics
- Error: TimeoutError
- Location: tests/quality/test_metrics.py:78
- Message: Test exceeded 30s timeout
๐ง Auto-Fix Results
๐ง APPLIED FIXES:
1. Added missing import: import unittest
2. Fixed syntax error: print statement
3. Added missing method: setUp()
4. Corrected indentation: 4 spaces
Configuration
โ๏ธ Test Configuration
{
"test_paths": ["tests/", "test_*.py", "*_test.py"],
"test_categories": ["unit", "integration", "system", "contracts"],
"timeout": 30,
"auto_fix": true,
"verbose": true,
"coverage": true,
"parallel": true
}
๐ฏ Environment Variables
# Enable auto-fix
export MAX_TESTS_AUTO_FIX=1
# Set test timeout
export MAX_TESTS_TIMEOUT=60
# Enable verbose output
export MAX_TESTS_VERBOSE=1
# Disable parallel execution
export MAX_TESTS_SEQUENTIAL=1
Integration
๐ CI/CD Integration
# .github/workflows/tests.yml
name: Comprehensive Tests
on: [push, pull_request]
jobs:
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Run comprehensive tests
run: /tests --report
- name: Upload test results
uses: actions/upload-artifact@v2
with:
name: test-results
path: tests/reports/
๐ง Pre-commit Hook
#!/bin/sh
# .git/hooks/pre-commit
/tests --quick
if [ $? -ne 0 ]; then
echo "โ Tests failed - commit blocked"
exit 1
fi
๐ Quality Gate Integration
# Run as part of quality gate
/max-quality --include-tests
# Fail build on test failures
/tests --strict
Advanced Features
๐ฏ Test Filtering
# Run tests matching pattern
/tests --pattern "test_*contract*"
# Exclude specific tests
/tests --exclude "test_slow_*"
# Run tests by file
/tests --file test_commands.py
# Run tests by directory
/tests --directory tests/unit/
๐ Performance Testing
# Run performance benchmarks
/tests --performance
# Measure execution time
/tests --timing
# Memory usage analysis
/tests --memory
๐ Debug Mode
# Run with debugger
/tests --debug
# Stop on first failure
/tests --failfast
# Run with detailed tracebacks
/tests --traceback
Reports
๐ Coverage Report
/tests --coverage
- Line coverage: 87.3%
- Branch coverage: 82.1%
- Function coverage: 91.5%
- Missing coverage: 12.7%
๐ Trend Analysis
/tests --trends
- Test count trend: +5 tests this week
- Success rate trend: 92% โ 95%
- Performance trend: -0.2s average
- Coverage trend: +2.3% this month
๐ Detailed Report
/tests --report --detailed
- Test execution summary
- Failure analysis
- Performance metrics
- Coverage breakdown
- Recommendations
Benefits
๐ฏ Comprehensive Coverage
- All test types: Unit, integration, system, contracts
- Multiple frameworks: unittest, pytest, custom
- Cross-platform: Linux, macOS, Windows
- Language support: Python, JavaScript, Shell
๐ง Intelligent Testing
- Auto-fix capabilities: Common error resolution
- Smart discovery: Automatic test finding
- Parallel execution: Faster test runs
- Caching: Avoid redundant work
๐ Detailed Insights
- Real-time progress: Live test execution
- Performance metrics: Timing and resource usage
- Trend analysis: Historical test data
- Quality metrics: Coverage and success rates
๐ Developer Friendly
- Easy integration: CI/CD, pre-commit hooks
- Flexible configuration: Customizable behavior
- Rich reporting: Multiple output formats
- Debug support: Detailed error information
The comprehensive testing system provides complete test coverage with intelligent automation and detailed reporting, ensuring code quality and reliability across the entire MAx Framework!
