# ASTRAL-Next Test Specifications Summary

## Overview
Comprehensive test specifications for the GPS-denied navigation system following the QA testing pyramid approach.

**Total Test Specifications**: 49

## Test Organization

### Integration Tests (01-16): Component Level
Tests individual system components in isolation with their dependencies.

**Vision Pipeline (01-04)**:
- 01: Sequential Visual Odometry (F07 - SuperPoint + LightGlue)
- 02: Global Place Recognition (F08 - AnyLoc/DINOv2)
- 03: Metric Refinement (F09 - LiteSAM)
- 04: Factor Graph Optimizer (F10 - GTSAM)

**Data Management (05-08)**:
- 05: Satellite Data Manager (F04)
- 06: Coordinate Transformer (F13)
- 07: Image Input Pipeline (F05)
- 08: Image Rotation Manager (F06)

**Service Infrastructure (09-12)**:
- 09: REST API (F01 - FastAPI endpoints)
- 10: SSE Event Streamer (F15 - real-time streaming)
- 11a: Flight Lifecycle Manager (F02.1 - CRUD, initialization, API delegation)
- 11b: Flight Processing Engine (F02.2 - processing loop, recovery coordination)
- 12: Result Manager (F14)

**Support Components (13-16)**:
- 13: Model Manager (F16 - TensorRT)
- 14: Failure Recovery Coordinator (F11)
- 15: Configuration Manager (F17)
- 16: Database Layer (F03)

### System Integration Tests (21-25): Multi-Component Flows
Tests integration between multiple components.

- 21: End-to-End Normal Flight
- 22: Satellite to Vision Pipeline (F04 → F07/F08/F09)
- 23: Vision to Optimization Pipeline (F07/F08/F09 → F10)
- 24: Multi-Component Error Propagation
- 25: Real-Time Streaming Pipeline (F02 → F14 → F15)

### Acceptance Tests (31-50): Requirements Validation
Tests mapped to 10 acceptance criteria.

**Accuracy (31-33)**:
- 31: AC-1 - 80% < 50m error (baseline)
- 32: AC-1 - 80% < 50m error (varied terrain)
- 33: AC-2 - 60% < 20m error (high precision)

**Robustness - Outliers (34-35)**:
- 34: AC-3 - Single 350m outlier handling
- 35: AC-3 - Multiple outliers handling

**Robustness - Sharp Turns (36-38)**:
- 36: AC-4 - Sharp turn zero overlap recovery
- 37: AC-4 - Sharp turn minimal overlap (<5%)
- 38: Outlier anchor detection

**Multi-Fragment (39)**:
- 39: AC-5 - Multi-fragment route connection (chunk architecture)

**User Interaction (40)**:
- 40: AC-6 - User input after 3 consecutive failures

**Performance (41-44)**:
- 41: AC-7 - <5s single image processing
- 42: AC-7 - Sustained throughput performance
- 43: AC-8 - Real-time streaming results
- 44: AC-8 - Async refinement delivery

**Quality Metrics (45-47)**:
- 45: AC-9 - Registration rate >95% (baseline)
- 46: AC-9 - Registration rate >95% (challenging conditions)
- 47: AC-10 - Mean Reprojection Error <1.0 pixels

**Cross-Cutting (48-50)**:
- 48: Long flight (3000 images)
- 49: Degraded satellite data
- 50: Complete system acceptance validation

**Chunk-Based Recovery (55-56)**:
- 55: Chunk rotation recovery (rotation sweeps for chunks)
- 56: Multi-chunk simultaneous processing (Atlas architecture)

### GPS-Analyzed Scenario Tests (51-54): Real Data
Tests using GPS-analyzed test datasets.

- 51: Test_Baseline (AD000001-030) - Standard flight
- 52: Test_Outlier_350m (AD000045-050) - Outlier scenario
- 53: Test_Sharp_Turn - Multiple sharp turn datasets
- 54: Test_Long_Flight (AD000001-060) - Full dataset

## Test Data

### GPS Analysis Results
- Mean distance: 120.8m
- Min distance: 24.2m
- Max distance: 268.6m

**Identified Sharp Turns (>200m)**:
- AD000003 → AD000004: 202.2m
- AD000032 → AD000033: 220.6m
- AD000042 → AD000043: 234.2m
- AD000044 → AD000045: 230.2m
- AD000047 → AD000048: 268.6m (largest outlier)

### Test Datasets
**Test_Baseline**: AD000001-030 (30 images, normal spacing)
**Test_Outlier_350m**: AD000045-050 (6 images, 268.6m outlier)
**Test_Sharp_Turn_A**: AD000042, AD000044, AD000045, AD000046 (skip 043)
**Test_Sharp_Turn_B**: AD000032-035 (220m jump)
**Test_Sharp_Turn_C**: AD000003, AD000009 (5-frame gap)
**Test_Long_Flight**: AD000001-060 (all 60 images, all variations)

## Acceptance Criteria Coverage

| AC | Requirement | Test Specs | Status |
|----|-------------|------------|--------|
| AC-1 | 80% < 50m error | 31, 32, 50, 51, 54 | ✓ Covered |
| AC-2 | 60% < 20m error | 33, 50, 51, 54 | ✓ Covered |
| AC-3 | 350m outlier robust | 34, 35, 50, 52, 54 | ✓ Covered |
| AC-4 | Sharp turn <5% overlap | 36, 37, 50, 53, 54, 55 | ✓ Covered |
| AC-5 | Multi-fragment connection | 39, 50, 56 | ✓ Covered |
| AC-6 | User input after 3 failures | 40, 50 | ✓ Covered |
| AC-7 | <5s per image | 41, 42, 50, 51, 54 | ✓ Covered |
| AC-8 | Real-time + refinement | 43, 44, 50 | ✓ Covered |
| AC-9 | Registration >95% | 45, 46, 50, 51, 54 | ✓ Covered |
| AC-10 | MRE <1.0px | 47, 50 | ✓ Covered |

## Component to Test Mapping

| Component | ID | Integration Test |
|-----------|-----|------------------|
| Flight API | F01 | 09 |
| Flight Lifecycle Manager | F02.1 | 11a |
| Flight Processing Engine | F02.2 | 11b |
| Flight Database | F03 | 16 |
| Satellite Data Manager | F04 | 05 |
| Image Input Pipeline | F05 | 07 |
| Image Rotation Manager | F06 | 08 |
| Sequential Visual Odometry | F07 | 01 |
| Global Place Recognition | F08 | 02 |
| Metric Refinement | F09 | 03 |
| Factor Graph Optimizer | F10 | 04 |
| Failure Recovery Coordinator | F11 | 14 |
| Route Chunk Manager | F12 | 39, 55, 56 |
| Coordinate Transformer | F13 | 06 |
| Result Manager | F14 | 12 |
| SSE Event Streamer | F15 | 10 |
| Model Manager | F16 | 13 |
| Configuration Manager | F17 | 15 |

## Test Execution Strategy

### Phase 1: Component Integration (01-16)
- Validate each component individually
- Verify interfaces and dependencies
- Establish baseline performance metrics

### Phase 2: System Integration (21-25)
- Test multi-component interactions
- Validate end-to-end flows
- Verify error handling across components

### Phase 3: Acceptance Testing (31-50)
- Validate all acceptance criteria
- Use GPS-analyzed real data
- Measure against requirements

### Phase 4: Special Scenarios (51-56)
- Test specific GPS-identified situations
- Validate outliers and sharp turns
- Chunk-based recovery scenarios
- Full system validation

## Success Criteria Summary

**Integration Tests**: All components pass individual tests, interfaces work correctly
**System Tests**: Multi-component flows work, errors handled properly
**Acceptance Tests**: All 10 ACs met with real data
**Overall**: System meets all requirements, ready for deployment

## Test Metrics to Track

- **Accuracy**: Mean error, RMSE, percentiles
- **Performance**: Processing time per image, total time
- **Reliability**: Registration rate, success rate
- **Quality**: MRE, confidence scores
- **Robustness**: Outlier handling, error recovery

## Notes

- All test specs follow standard format (Integration vs Acceptance)
- GPS-analyzed datasets based on actual test data coordinates
- Specifications ready for QA team implementation
- No code included per requirement
- Tests cover all components and all acceptance criteria
