# TheChart Scripts Directory This directory contains utility scripts and the **new consolidated test suite** for TheChart application. ## 🚀 Quick Start ### Run All Tests ```bash cd /home/will/Code/thechart .venv/bin/python scripts/run_tests.py ``` ### Run Specific Test Categories ```bash # Unit tests only .venv/bin/python scripts/quick_test.py unit # Integration tests only .venv/bin/python scripts/quick_test.py integration # Theme-related tests only .venv/bin/python scripts/quick_test.py theme ``` ## 📁 Current Structure ### Active Scripts #### `run_tests.py` 🎯 **Main test runner** - executes the complete test suite with coverage reporting. - Runs unit tests with coverage - Runs integration tests - Runs legacy integration tests for backwards compatibility - Provides comprehensive test summary #### `quick_test.py` ⚡ **Quick test runner** - for specific test categories during development. - `unit` - Fast unit tests only - `integration` - Integration tests only - `theme` - Theme-related functionality tests - `all` - Complete test suite #### `integration_test.py` 🔄 **Legacy integration test** - maintained for backwards compatibility. - Tests export system functionality - No GUI dependencies - Called automatically by the main test runner ### Test Organization #### Unit Tests (`/tests/`) - `test_*.py` - Individual module tests - Uses pytest framework - Fast execution, isolated tests - Coverage reporting enabled #### Integration Tests (`tests/test_integration.py`) - **Consolidated integration test suite** - Tests complete workflows and interactions - Includes functionality from old standalone scripts: - Note saving and retrieval - Entry updates and validation - Theme changing functionality - Keyboard shortcuts binding - Menu theming integration - Export system testing - Data validation and error handling ## 🔄 Migration from Old Structure The old individual test scripts have been **consolidated** into the unified test suite: | Old Script | New Location | How to Run | |------------|--------------|------------| | `test_note_saving.py` | `tests/test_integration.py::test_note_saving_functionality` | `quick_test.py integration` | | `test_update_entry.py` | `tests/test_integration.py::test_entry_update_functionality` | `quick_test.py integration` | | `test_keyboard_shortcuts.py` | `tests/test_integration.py::test_keyboard_shortcuts_binding` | `quick_test.py integration` | | `test_theme_changing.py` | `tests/test_integration.py::test_theme_changing_functionality` | `quick_test.py theme` | | `test_menu_theming.py` | `tests/test_integration.py::test_menu_theming_integration` | `quick_test.py theme` | ### Benefits of New Structure 1. **Unified Framework**: All tests use pytest 2. **Better Organization**: Related tests grouped logically 3. **Improved Performance**: Optimized setup/teardown 4. **Coverage Reporting**: Integrated coverage analysis 5. **CI/CD Ready**: Easier automation and integration ## 🛠️ Development Workflow ### During Development ```bash # Quick unit tests (fastest feedback) .venv/bin/python scripts/quick_test.py unit # Test specific functionality .venv/bin/python scripts/quick_test.py theme ``` ### Before Commits ```bash # Full test suite with coverage .venv/bin/python scripts/run_tests.py ``` ### Individual Test Debugging ```bash # Run specific test with output .venv/bin/python -m pytest tests/test_integration.py::TestIntegrationSuite::test_theme_changing_functionality -v -s # Run with debugger .venv/bin/python -m pytest tests/test_integration.py::TestIntegrationSuite::test_note_saving_functionality -v -s --pdb ``` ## 📋 Available Test Categories ### Unit Tests - Fast, isolated component tests - Mock external dependencies - Test individual functions and classes ### Integration Tests - Test component interactions - Test complete workflows - Validate data persistence - Test UI functionality (without GUI display) ### Theme Tests - Theme switching functionality - Color scheme validation - Menu theming consistency - Error handling in theme system ### System Health Checks - Configuration file validation - Manager initialization tests - Logging system verification ## 🏃‍♂️ Performance Tips - Use `quick_test.py unit` for fastest feedback during development - Use `quick_test.py integration` to test workflow changes - Use `quick_test.py theme` when working on UI/theming - Use `run_tests.py` for comprehensive testing before commits ## 🔧 Debugging Tests ### Common Commands ```bash # Run with verbose output .venv/bin/python -m pytest tests/ -v # Stop on first failure .venv/bin/python -m pytest tests/ -x # Show local variables on failure .venv/bin/python -m pytest tests/ -l # Run with debugger on failure .venv/bin/python -m pytest tests/ --pdb ``` ### Debugging Specific Issues ```bash # Debug theme issues .venv/bin/python -m pytest tests/test_integration.py::TestIntegrationSuite::test_theme_changing_functionality -v -s # Debug data management .venv/bin/python -m pytest tests/test_data_manager.py -v -s # Debug export functionality .venv/bin/python scripts/integration_test.py ``` --- 📖 **See Also**: `TESTING_MIGRATION.md` for detailed migration information.