Skip to content

Testing Quick Reference ​

Last updated: 2026-03-22

One-page reference for running tests in Filament Address Pro.

Quick Commands ​

bash
# Run everything (5 min)
php artisan test

# Fast feedback loop (< 5s)
php artisan test --testsuite=Unit --testsuite=Integration

# Before commit (< 15s)
php artisan test --exclude-group=api,pre-release

# Quick health check (< 10s)
php artisan test --group=smoke,performance

# Before release
php artisan test --group=pre-release

Test Suites ​

SuiteTestsSpeedCommand
Unit252~0.14sphp artisan test --testsuite=Unit
Integration868 (4 skipped)~3-5sphp artisan test --testsuite=Integration
Feature72Variablephp artisan test --testsuite=Feature
Smoke73 (6 skipped)~7.5sphp artisan test --testsuite=Smoke
Performance37 (2 skipped)~0.74sphp artisan test --testsuite=Performance
Total1,302 passed, 12 skipped~4.5 minphp artisan test

Test Groups ​

bash
# Smoke tests (quick health checks)
php artisan test --group=smoke

# Performance benchmarks
php artisan test --group=performance

# Pre-release validation (256 countries)
php artisan test --group=pre-release

# International address tests
php artisan test --group=international

# Exclude API tests (for CI)
php artisan test --exclude-group=api

Smoke Test Categories ​

bash
# All smoke tests
php artisan test --group=smoke

# Specific categories
php artisan test --group=smoke-api           # External API tests only
php artisan test --group=smoke-components    # Component instantiation only

# Exclude API tests (for CI)
php artisan test --group=smoke --exclude-group=smoke-api

Performance Test Categories ​

bash
# All performance tests
php artisan test --group=performance

# All performance tests (no sub-groups defined)
php artisan test --testsuite=Performance

Running Specific Tests ​

bash
# By file
php artisan test packages/filament-address-pro/tests/Unit/Extractors/JapaneseAddressExtractorTest.php

# By name pattern
php artisan test --filter="japanese extractor"

# By multiple filters
php artisan test --filter="geocoding|subdivision"

Development Workflows ​

During Development (Fast Feedback) ​

bash
# Run after each change (< 5s)
php artisan test --testsuite=Unit --testsuite=Integration

Before Git Commit ​

bash
# Comprehensive but fast (< 15s)
php artisan test --exclude-group=api,pre-release

Before Git Push ​

bash
# Health check + performance (< 10s)
php artisan test --group=smoke,performance

Before Pull Request ​

bash
# Full suite (< 5 min)
php artisan test

Before Release ​

bash
# Full validation
php artisan test
php artisan test --group=pre-release

CI/CD Workflows ​

Pull Request ​

bash
php artisan test --testsuite=Unit
php artisan test --testsuite=Integration
php artisan test --group=smoke --exclude-group=smoke-api

Nightly Build ​

bash
php artisan test
php artisan test --group=performance

Pre-Release ​

bash
php artisan test
php artisan test --group=pre-release

Test Database Setup ​

One-Time Setup ​

bash
# Create database
mysql -u root -e "CREATE DATABASE filament_addresses_test;"

# Run migrations
DB_DATABASE=filament_addresses_test php artisan migrate --force \
  --path="packages/filament-address-pro/database/migrations"

# Seed data
DB_DATABASE=filament_addresses_test php artisan db:seed \
  --class="Viewflex\FilamentAddress\Database\Seeders\CountriesDomainSeeder"

Reset Database ​

bash
DB_DATABASE=filament_addresses_test php artisan migrate:fresh --force
DB_DATABASE=filament_addresses_test php artisan migrate --force \
  --path="packages/filament-address-pro/database/migrations"
DB_DATABASE=filament_addresses_test php artisan db:seed \
  --class="Viewflex\FilamentAddress\Database\Seeders\CountriesDomainSeeder"

Coverage Summary ​

CategoryCountWhat It Tests
Pure Unit112Business logic, no dependencies
Integration868 (4 skipped)Laravel + Database (includes pre-release validation)
Feature72Full-stack + APIs
Smoke73 (6 skipped)Health checks
Performance37 (2 skipped)Timing benchmarks
TOTAL1,302 passed, 12 skipped60,000+ assertions

Troubleshooting ​

Tests Fail with "Class not found" ​

bash
composer dump-autoload

Database Tests Fail ​

bash
DB_DATABASE=filament_addresses_test php artisan migrate:fresh --force
DB_DATABASE=filament_addresses_test php artisan migrate --force \
  --path="packages/filament-address-pro/database/migrations"
DB_DATABASE=filament_addresses_test php artisan db:seed \
  --class="Viewflex\FilamentAddress\Database\Seeders\CountriesDomainSeeder"

Memory Limit ​

bash
php -d memory_limit=512M artisan test

Too Slow ​

bash
# Run only fast tests
php artisan test --testsuite=Unit --testsuite=Integration

Performance Baselines ​

All operations should meet these baselines:

OperationBaseline
Service instantiation< 1ms
Subdivision retrieval< 2ms
Extractor execution< 0.2ms
Cache key generation< 0.01ms
Fixture parsing< 0.5ms

Run performance tests to verify: php artisan test --group=performance


Test Groups Reference ​

GroupPurposeSpeedUse When
smokeHealth checks~7.5sDaily, after setup
smoke-apiAPI connectivityVariableManual only
performanceBenchmarks~0.7sBefore release
pre-releaseAll countries~2minBefore release
international46 countries~0.5sAfter changes
apiExternal APIsVariableManual only

Documentation ​

  • Full Testing Guide: TESTING.md
  • Smoke Tests: tests/Smoke/README.md
  • Performance Tests: tests/Performance/README.md

Test Architecture ​

           Feature Tests (52)
              Full Stack
                  ↑
     Integration Tests (521)
        Laravel + Database
                  ↑
       Pure Unit Tests (112)
         Business Logic

    Smoke Tests (71)     Performance Tests (37)
   Quick Validation      Timing Benchmarks

Test Pyramid: More unit tests, fewer feature tests Smoke Tests: Horizontal health checks across all layers Performance Tests: Continuous benchmarking


Key Principles ​

  1. Fast Feedback: Unit + Integration = < 5s
  2. Test Behavior: Not implementation details
  3. Smoke Tests: Run daily for health
  4. Performance: Catch regressions early
  5. Pre-Release: Validate all 256 countries

Support ​

For detailed documentation: docs/TESTING.md

For questions or issues: See package documentation

Released under a commercial license.