58 lines
1.9 KiB
Markdown

# Testing
## Run the Test Suite
```powershell
mvn test
```
## Test Strategy
The project uses a mix of unit and integration tests:
- **Unit tests** for isolated business logic and service behavior
- **Integration tests** for filesystem/SQLite behavior and output artifacts
- **Mock-based tests** for MQTT and process-launch behavior
Frameworks:
- JUnit Jupiter
- Mockito JUnit Jupiter
## Test Inventory
| Test Class | Type | Main Focus |
|---|---|---|
| `AppStateTest` | Unit | state defaults and listener notifications |
| `BinaryEventServiceTest` | Unit | payload validation and duplicate handling |
| `EvaluationServiceTest` | Unit | ratio-threshold mapping and animation side effect |
| `StatisticsServiceTest` | Unit + Integration | rolling averages and ratio calculation |
| `DataPersistenceServiceTest` | Integration | SQLite persistence and retrieval ordering |
| `MqttClientServiceTest` | Unit (mocked client) | MQTT connect/subscribe/publish callbacks |
| `ProcessManagerServiceTest` | Unit (injected launcher) | process startup/shutdown and healthcheck reporting |
| `AnimationFileServiceTest` | Integration | JSON output mapping and overwrite behavior |
## What Is Covered Well
- Core event pipeline behavior
- Threshold logic and level transitions
- Persistence query correctness
- Managed process command generation and reporting
- Animation output mapping to domain levels
## Known Testing Gaps
- No full end-to-end GUI automation (Swing/JCEF interaction)
- No performance/load tests for high MQTT throughput
- No integration tests for real external Unreal processes in CI
- No property-based or fuzz testing for malformed payload variants
## Manual Verification Checklist
After a successful run, verify:
1. MQTT status in the UI changes to connected.
2. New payloads affect chart and level bar.
3. `animation.output.path` file is updated when level changes.
4. Shutdown stops optional processes and closes the application cleanly.