Skip to content

Testing‐Guide

kenTHiC edited this page Aug 19, 2025 · 1 revision

🧪 Testing Guide

Comprehensive guide to testing BizGrow v1.3.3, including the enhanced testing suite, manual testing procedures, and quality assurance practices.


🎯 Overview

BizGrow includes a comprehensive testing framework designed to ensure reliability and quality across all features, with special focus on the new v1.3.3 functionality.

Testing Philosophy

  • Comprehensive Coverage - 25+ automated tests covering all major functionality
  • User-Centric - Tests focus on real user scenarios and workflows
  • Performance Aware - Tests include performance benchmarks and memory usage
  • Developer Friendly - Easy-to-use testing tools and clear feedback

🚀 Quick Start Testing

Visual Testing Interface

  1. Start Development Server

    npm run dev
  2. Access Test Runner

    • Navigate to Dashboard page
    • Click green "Test Suite" button next to "Manage Data"
    • TestRunner dialog appears in bottom-right corner
  3. Run Tests

    • Select test type from dropdown
    • Click "Run Tests" button
    • View results in console and dialog

Console Testing

// Open browser console (F12) and run:

// Full comprehensive test suite
window.BizGrowTestSuite.runAllTests()

// Quick essential tests
window.BizGrowTestSuite.quickTest()

// Individual test categories
window.BizGrowTestSuite.testMultiSelection()
window.BizGrowTestSuite.testModalSystem()
window.BizGrowTestSuite.testIdManagement()
window.BizGrowTestSuite.testPerformance()
window.BizGrowTestSuite.testVersionSynchronization()

// Debug and utilities
window.BizGrowTestSuite.debugState()
window.BizGrowTestSuite.exportResults()

🧩 Test Categories

1. Multi-Selection Tests

Tests the core v1.3.3 multi-selection functionality:

window.BizGrowTestSuite.testMultiSelection()

What it tests:

  • Set-based selection logic preventing duplicates
  • ID normalization (string vs number handling)
  • Toggle selection functionality
  • Select All/Deselect All operations
  • Selection state persistence

Expected Results:

  • ✅ Set prevents duplicate selections
  • ✅ ID normalization works correctly
  • ✅ Toggle selection maintains proper state
  • ✅ Select All functionality works as expected

2. Modal System Tests

Tests the professional UI modal system:

window.BizGrowTestSuite.testModalSystem()

What it tests:

  • Modal state management (open/close)
  • Props generation for different modal types
  • State reset functionality
  • Event handling

Expected Results:

  • ✅ Modals open and close correctly
  • ✅ State is properly managed
  • ✅ Props are generated correctly for different modal types

3. ID Management Tests

Tests data integrity and ID uniqueness:

window.BizGrowTestSuite.testIdManagement()

What it tests:

  • Duplicate ID detection in datasets
  • ID uniqueness enforcement
  • Sequential ID generation
  • Data migration and fixing

Expected Results:

  • ✅ Duplicate IDs are detected
  • ✅ ID uniqueness is enforced
  • ✅ Sequential ID generation works correctly

4. Performance Tests

Tests application performance and scalability:

window.BizGrowTestSuite.testPerformance()

What it tests:

  • Large dataset generation (1000+ items)
  • Set operations performance
  • Memory usage estimation
  • Operation timing benchmarks

Expected Results:

  • ✅ Large datasets generated quickly (<100ms for 1000 items)
  • ✅ Set operations are efficient (<50ms for 1000 operations)
  • ✅ Memory usage is reasonable

5. Version Synchronization Tests

Tests automatic version management:

window.BizGrowTestSuite.testVersionSynchronization()

What it tests:

  • DataStore version accessibility
  • Semantic versioning format compliance
  • Version source identification (package.json vs fallback)
  • Version info method functionality

Expected Results:

  • ✅ Version is accessible and properly formatted
  • ✅ Version source is correctly identified
  • ✅ Version info methods work correctly

📊 Test Results Interpretation

Test Output Format

🧪 [12:34:56] Testing Multi-Selection Functionality...
✅ [12:34:56] PASS: Set-based selection prevents duplicates
✅ [12:34:56] PASS: ID normalization works correctly
✅ [12:34:56] PASS: Toggle selection works correctly
✅ [12:34:56] Multi-Selection tests completed

📋 TEST SUITE SUMMARY
==========================================
✅ Passed: 23
❌ Failed: 0
📊 Total: 23
⏱️ Duration: 2.45s
📈 Success Rate: 100%

Success Indicators

  • All tests passing - Application is stable and ready
  • 📈 100% success rate - No critical issues detected
  • Fast execution - Performance is optimal (<5 seconds total)

Warning Signs

  • ⚠️ Some tests failing - Investigate specific failures
  • 🐛 Performance degradation - Tests taking longer than expected
  • 💾 High memory usage - Potential memory leaks detected

🔧 Manual Testing Procedures

Core Functionality Testing

Customer Management

  1. Add Customer

    • Fill out customer form with valid data
    • Submit and verify customer appears in list
    • Check data persistence after page refresh
  2. Edit Customer

    • Click edit button on existing customer
    • Modify information and save
    • Verify changes are reflected
  3. Delete Customer

    • Click delete button
    • Confirm deletion in modal
    • Verify customer is removed

Revenue/Expense Management

  1. Add Revenue/Expense

    • Navigate to Reports page
    • Add new revenue or expense entry
    • Verify data appears correctly
  2. Multi-Selection Operations

    • Click "Select Multiple"
    • Select individual items using checkboxes
    • Test "Select All" functionality
    • Perform bulk delete operation

Data Import/Export

  1. CSV Import

    • Click "Manage Data" button
    • Upload CSV file with test data
    • Verify data is imported correctly
    • Check for proper data type detection
  2. Data Export

    • Export data in JSON and CSV formats
    • Verify exported files contain correct data
    • Test import of exported data

UI/UX Testing

Modal System

  1. Confirmation Modals

    • Trigger delete operations
    • Verify custom modals appear (not browser alerts)
    • Test modal animations and interactions
    • Confirm proper button functionality
  2. Toast Notifications

    • Perform various operations
    • Verify toast notifications appear
    • Check auto-dismiss functionality
    • Test different toast types (success, error, warning)

Responsive Design

  1. Desktop Testing

    • Test on different screen sizes (1920x1080, 1366x768)
    • Verify layout adapts properly
    • Check all functionality works
  2. Mobile Testing

    • Test on mobile devices or browser dev tools
    • Verify touch interactions work
    • Check responsive layout

🔍 Debugging and Troubleshooting

Debug Commands

// Check application state
window.BizGrowTestSuite.debugState()

// Check DataStore version info
window.dataStore.getVersionInfo()

// Check localStorage usage
window.BizGrowTestSuite.getStorageUsage()

// Export test results for bug reports
window.BizGrowTestSuite.exportResults()

Common Issues and Solutions

Tests Failing

  1. Refresh the page - Clear any state issues
  2. Check browser console - Look for JavaScript errors
  3. Clear localStorage - Remove corrupted data
  4. Update browser - Ensure modern browser support

Performance Issues

  1. Close other tabs - Free up memory
  2. Restart browser - Clear memory leaks
  3. Check system resources - Ensure adequate RAM
  4. Run individual tests - Isolate performance issues

Test Suite Not Available

// Check if test suite is loaded
if (typeof window.BizGrowTestSuite === 'undefined') {
  console.error('Test suite not loaded. Refresh the page.');
}

📈 Performance Benchmarks

Expected Performance Metrics

Test Category Expected Duration Memory Usage Items Tested
Multi-Selection <1s <10MB 1000 items
Modal System <0.5s <5MB All modal types
ID Management <0.5s <5MB 1000 IDs
Performance <2s <20MB Large datasets
Version Sync <0.1s <1MB Version info

Performance Monitoring

// Monitor test execution time
const startTime = performance.now();
await window.BizGrowTestSuite.runAllTests();
const duration = performance.now() - startTime;
console.log(`Tests completed in ${duration.toFixed(2)}ms`);

// Monitor memory usage
const memoryInfo = performance.memory;
console.log('Memory usage:', {
  used: Math.round(memoryInfo.usedJSHeapSize / 1024 / 1024) + 'MB',
  total: Math.round(memoryInfo.totalJSHeapSize / 1024 / 1024) + 'MB'
});

🤝 Contributing to Tests

Adding New Tests

  1. Identify Test Need

    • New feature requiring testing
    • Bug that needs regression testing
    • Performance concern
  2. Write Test Function

    testNewFeature() {
      this.log('🧪 Testing New Feature...', 'info');
      
      // Test implementation
      const result = performTestOperation();
      
      this.assert(
        result === expectedValue,
        'New feature works correctly',
        `Expected ${expectedValue}, got ${result}`
      );
      
      this.log('✅ New Feature tests completed', 'success');
    }
  3. Add to Test Suite

    • Add to runAllTests() method
    • Add to global window object
    • Update documentation

Test Writing Guidelines

  • Clear Names - Test names should describe what they test
  • Isolated Tests - Tests should not depend on each other
  • Comprehensive Assertions - Test both positive and negative cases
  • Performance Aware - Include timing and memory considerations
  • Good Logging - Provide clear feedback about test progress

📞 Getting Help

If you encounter testing issues:

  1. Check Documentation - Review this guide thoroughly
  2. Run Debug Commands - Use built-in debugging tools
  3. Export Results - Generate detailed test reports
  4. Search Issues - Look through GitHub Issues
  5. Create Issue - Report bugs with test results attached
  6. Community Support - Ask in Discord

Related Documentation:

Clone this wiki locally