Skip to content

Latest commit

 

History

History
98 lines (68 loc) · 3.58 KB

README.md

File metadata and controls

98 lines (68 loc) · 3.58 KB

Testing Overview

Ashfolio testing overview and quick commands.

Quick Start

# Run all tests (excludes slow seeding tests)
just test

# Run tests with specific focus areas
just test-fast          # Development feedback loop (< 100ms tests)
just test-ash           # Ash Resource business logic
just test-liveview      # Phoenix LiveView components
just test-calculations  # Portfolio calculations
just test-integration   # End-to-end workflows

Testing Architecture

Global Test Data Management 🆕

Core Testing Documentation

Testing Framework

Tests organized by system layers with performance categorization and SQLite concurrency handling.

Core Testing Categories

Category Purpose Command
Fast Tests Development feedback loop just test-fast
Ash Resources Business logic validation just test-ash
LiveView UI components and interactions just test-liveview
Calculations Portfolio math and FIFO logic just test-calculations
Integration End-to-end system workflows just test-integration

Documentation Structure

Core Testing Documents

For detailed testing patterns and strategies, see Testing Strategy.

⚠️ Critical for v0.3.0+

Global test data management is essential for reliable testing. See Global Test Data Requirements for:

  • Why global test data exists in Ashfolio
  • SQLite concurrency handling requirements
  • Standards for test isolation and data management

Test Database Management

Health Checks & Safeguards

# NEW: Comprehensive test database safeguards
just test-health-check              # Validate test database health
just test-safe                      # Run tests with automatic health checks
just test-db-emergency-reset        # Emergency recovery for mass failures

Database Reset Procedures

# Complete test database reset (most common fix)
MIX_ENV=test mix ecto.drop && MIX_ENV=test mix ecto.create && MIX_ENV=test mix ecto.migrate
MIX_ENV=test mix run -e "Ashfolio.SQLiteHelpers.setup_global_test_data!()"
just test-fast  # Verify fix

Testing Statistics

  • 300+ comprehensive tests
  • 100% (maintained through database safeguards)
  • All architectural layers with comprehensive edge cases
  • Fast development feedback with sub-100ms test categories

Getting Help


Quick reference: just test-health-check for any test issues