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-releaseTest Suites
| Suite | Tests | Speed | Command |
|---|---|---|---|
| Unit | 112 | ~0.14s | php artisan test --testsuite=Unit |
| Integration | 521 (4 skipped) | ~3-5s | php artisan test --testsuite=Integration |
| Feature | 52 | Variable | php artisan test --testsuite=Feature |
| Smoke | 71 (6 skipped) | ~7.5s | php artisan test --testsuite=Smoke |
| Performance | 37 (2 skipped) | ~0.74s | php artisan test --testsuite=Performance |
| Total | 1062 passed, 10 skipped | ~4.5 min | php 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=apiSmoke 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-apiPerformance Test Categories
bash
# All performance tests
php artisan test --group=performance
# All performance tests (no sub-groups defined)
php artisan test --testsuite=PerformanceRunning 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=IntegrationBefore Git Commit
bash
# Comprehensive but fast (< 15s)
php artisan test --exclude-group=api,pre-releaseBefore Git Push
bash
# Health check + performance (< 10s)
php artisan test --group=smoke,performanceBefore Pull Request
bash
# Full suite (< 5 min)
php artisan testBefore Release
bash
# Full validation
php artisan test
php artisan test --group=pre-releaseCI/CD Workflows
Pull Request
bash
php artisan test --testsuite=Unit
php artisan test --testsuite=Integration
php artisan test --group=smoke --exclude-group=smoke-apiNightly Build
bash
php artisan test
php artisan test --group=performancePre-Release
bash
php artisan test
php artisan test --group=pre-releaseTest 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
| Category | Count | What It Tests |
|---|---|---|
| Pure Unit | 112 | Business logic, no dependencies |
| Integration | 521 (4 skipped) | Laravel + Database (includes pre-release validation) |
| Feature | 52 | Full-stack + APIs |
| Smoke | 71 (6 skipped) | Health checks |
| Performance | 37 (2 skipped) | Timing benchmarks |
| TOTAL | 1062 passed, 10 skipped | 60,000+ assertions |
Troubleshooting
Tests Fail with "Class not found"
bash
composer dump-autoloadDatabase 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 testToo Slow
bash
# Run only fast tests
php artisan test --testsuite=Unit --testsuite=IntegrationPerformance Baselines
All operations should meet these baselines:
| Operation | Baseline |
|---|---|
| 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
| Group | Purpose | Speed | Use When |
|---|---|---|---|
smoke | Health checks | ~7.5s | Daily, after setup |
smoke-api | API connectivity | Variable | Manual only |
performance | Benchmarks | ~0.7s | Before release |
pre-release | All countries | ~2min | Before release |
international | 46 countries | ~0.5s | After changes |
api | External APIs | Variable | Manual 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 BenchmarksTest Pyramid: More unit tests, fewer feature tests Smoke Tests: Horizontal health checks across all layers Performance Tests: Continuous benchmarking
Key Principles
- Fast Feedback: Unit + Integration = < 5s
- Test Behavior: Not implementation details
- Smoke Tests: Run daily for health
- Performance: Catch regressions early
- Pre-Release: Validate all 256 countries
Support
For detailed documentation: docs/TESTING.md
For questions or issues: See package documentation