13 KiB
13 KiB
Acceptance Tests
Purpose
Comprehensive test catalog derived from the current codebase. Each test is runnable in Simulation and described for Real Box hardware. Behaviors not implemented are explicitly marked.
Prerequisites
- Repo root
- Python 3
- Box API running for Simulation:
python3 box/main.py run - GUI optional:
cd gui && npm run dev
Step-by-step
Use the tests below in order or individually.
Test A: Box-Start & Identitaet (box_id)
- Goal
- Verify box_id is created once and persists.
- Preconditions
- Simulation:
box/data/box.jsonmay be missing. - Real Box: storage is empty or fresh install.
- Procedure – Simulation / Emulation
- Start Box:
python3 box/main.py run
- Check box_id in API:
curl http://127.0.0.1:8000/status
- Inspect file:
cat box/data/box.json
- Procedure – Real Box (Hardware)
- Power on device.
- Open status UI (if available) or API endpoint.
- Expected Result
/statuscontainsbox_idwith formatklangkiste-<10 chars a-z0-9>.box/data/box.jsoncontainsbox_idand is stable across restarts.
- Deviations / Troubleshooting
box_idmissing: check write permissions forbox/data/.box_idchanges: indicates manual deletion ofbox/data/box.json.
Test B: WLAN-Ersteinrichtung (Setup WebGUI)
- Goal
- Configure WiFi profile via setup UI and reach WIFI_ONLINE.
- Preconditions
- No WiFi profiles stored.
- Procedure – Simulation / Emulation
- Reset WiFi profiles:
curl -X POST http://127.0.0.1:8000/command \
-H "Content-Type: application/json" \
-d '{"command":"wifi_reset"}'
- Open Setup UI:
http://127.0.0.1:9000/setup
- Choose SSID and enter password, click "Verbinden".
- Check status:
curl http://127.0.0.1:8000/status
- Procedure – Real Box (Hardware)
- Power on device.
- Connect to device AP SSID (not implemented in code).
- Open setup page and submit WiFi credentials.
- Expected Result
wifi_state = WIFI_ONLINEconnected_ssidmatches selected SSIDwifi_profiles_countincrements
- Deviations / Troubleshooting
- Setup UI unreachable: port 9000 occupied or Box not running.
- Not testable with current code: AP SSID and real WiFi connect.
Test C: Persistenz & Neustart
- Goal
- Ensure resume state and WiFi profiles persist across restarts.
- Preconditions
- At least one WiFi profile stored.
- Playback started once.
- Procedure – Simulation / Emulation
- Add WiFi profile (if needed):
curl -X POST http://127.0.0.1:8000/command \
-H "Content-Type: application/json" \
-d '{"command":"wifi_add_profile","payload":{"ssid":"HomeWiFi","password":"secret","priority":10}}'
- Start playback:
curl -X POST http://127.0.0.1:8000/command \
-H "Content-Type: application/json" \
-d '{"command":"nfc_on","payload":{"uid":"UID_1"}}'
- Stop playback:
curl -X POST http://127.0.0.1:8000/command \
-H "Content-Type: application/json" \
-d '{"command":"nfc_off","payload":{"uid":"UID_1"}}'
- Restart Box process.
- Check status:
curl http://127.0.0.1:8000/status
- Procedure – Real Box (Hardware)
- Start playback via NFC.
- Power cycle device.
- Verify WiFi profile and resume state persist.
- Expected Result
box/data/state.jsoncontainsresume.box/data/secrets.encexists and contains profiles (encrypted).- After restart,
wifi_stateis not UNCONFIGURED.
- Deviations / Troubleshooting
- Resume missing: check
box/data/state.json. - WiFi profiles missing: check
box/data/secrets.enccreation.
Test D: HTTP API Status & Commands
- Goal
- Verify /status and /command are functional.
- Preconditions
- Box running.
- Procedure – Simulation / Emulation
- Status:
curl http://127.0.0.1:8000/status
- Command:
curl -X POST http://127.0.0.1:8000/command \
-H "Content-Type: application/json" \
-d '{"command":"play_pause"}'
- Procedure – Real Box (Hardware)
- Same as above once API is reachable in real network.
- Expected Result
- HTTP 200 responses.
/statusfields updated after commands.
- Deviations / Troubleshooting
- CORS errors: ensure API is running.
- 400 errors: check payload requirements.
Test E: GUI-Steuerung
- Goal
- Verify GUI can control playback and display status.
- Preconditions
- Box running on 127.0.0.1:8000.
- GUI running on 127.0.0.1:5174.
- Procedure – Simulation / Emulation
- Open GUI:
http://127.0.0.1:5174
- Click Play / Pause, Next, Prev, Vol +, Vol -.
- Click NFC UID_1 ON/OFF.
- Watch status refresh (polling every 1s).
- Procedure – Real Box (Hardware)
- Use GUI from another device pointing to Box IP.
- Expected Result
/statuschanges after each button.- GUI shows updated status and last_error if present.
- Deviations / Troubleshooting
- GUI shows "Failed to fetch": verify VITE_BOX_API_URL.
Test F: Playback & NFC
- Goal
- Verify NFC starts playback from tags.
- Preconditions
- Tags exist in
box/data/box.json. - Media exists under
box/data/media.
- Procedure – Simulation / Emulation
- Start playback:
curl -X POST http://127.0.0.1:8000/command \
-H "Content-Type: application/json" \
-d '{"command":"nfc_on","payload":{"uid":"UID_1"}}'
- Observe
/status:
curl http://127.0.0.1:8000/status
- Procedure – Real Box (Hardware)
- Place NFC tag mapped to UID_1.
- Expected Result
playback_state.state = PLAYINGactive_uid = UID_1
- Deviations / Troubleshooting
- No playback: check tags in
box/data/box.jsonand files inbox/data/media.
Test G: Resume-Logik
- Goal
- Resume picks up last file index and position per UID.
- Preconditions
- Playback started at least once for UID_1.
- Procedure – Simulation / Emulation
- Start playback, wait ~5s.
- Stop with
nfc_off. - Start again with
nfc_on.
- Procedure – Real Box (Hardware)
- Place NFC tag, remove, place again.
- Expected Result
- Resume uses stored
file_indexandposition. box/data/state.jsoncontains resume for UID_1.
- Deviations / Troubleshooting
- Resume resets to 0: check
state.jsonand path changes.
Test H: Ordner- & Rekursionslogik
- Goal
- Verify recursive ordering (DFS, folders first, lexicographic).
- Preconditions
- Nested media structure in
box/data/media.
- Procedure – Simulation / Emulation
- Create nested structure in
box/data/media/book_6/CD1/.... - Point a tag to
media/book_6inbox/data/box.json. - Start playback with
nfc_on.
- Procedure – Real Box (Hardware)
- Copy nested folders to the device media path.
- Start playback via NFC.
- Expected Result
- Files play in DFS order: subfolders sorted, then files.
- Deviations / Troubleshooting
- Ordering unexpected: check folder names and lexicographic sort.
Test I: Offline-Szenarien (Box intern)
- Goal
- Verify WiFi and Spotify states in offline/online flows.
- Preconditions
- Box running.
- Procedure – Simulation / Emulation
- WiFi reset:
curl -X POST http://127.0.0.1:8000/command \
-H "Content-Type: application/json" \
-d '{"command":"wifi_reset"}'
- Spotify clear:
curl -X POST http://127.0.0.1:8000/command \
-H "Content-Type: application/json" \
-d '{"command":"spotify_clear"}'
- Procedure – Real Box (Hardware)
- Not testable with current code: real network loss and Spotify connectivity.
- Expected Result
wifi_state = WIFI_UNCONFIGUREDspotify_status = NOT_CONFIGURED
- Deviations / Troubleshooting
- Status unchanged: ensure you read
/statusafter command.
Test J: Fehlerfaelle (Box intern)
- Goal
- Verify error sound and error reporting.
- Preconditions
- Box running.
- Procedure – Simulation / Emulation
- Trigger error:
curl -X POST http://127.0.0.1:8000/command \
-H "Content-Type: application/json" \
-d '{"command":"trigger_error","payload":{"type":"uid_unmapped"}}'
- Check
/statusforlast_error.
- Procedure – Real Box (Hardware)
- Not testable with current code: actual error sound output.
- Expected Result
playback_state.last_errorequals error type.- Box returns to
IDLEafter error.
- Deviations / Troubleshooting
- No error shown: verify
/statusand that errors are not cleared automatically.
Test K: Announce -> neue Box erscheint im Server
- Ziel
- Box meldet sich beim Server und erscheint als UNPAIRED / neue Box.
- Voraussetzungen
- Simulation: Server-Komponente vorhanden und laeuft.
- Real Box: Server erreichbar im Netzwerk.
- Durchfuehrung – Simulation / Emulation
- Nicht testbar mit aktuellem Code: Box sendet keine Announce-Requests.
- Durchfuehrung – Reale Box (Hardware)
- Nicht testbar mit aktuellem Code: Announce-Logik ist nicht implementiert.
- Erwartetes Ergebnis
- Nicht testbar mit aktuellem Code.
- Abweichungen / Fehlersuche
- Wenn implementiert: Pruefe Server-Logs, API-Endpunkte und Box-Statusfelder.
Test L: Mehrere Boxen gleichzeitig
- Ziel
- Mehrere Boxen werden als separate, unbekannte Boxen erkannt.
- Voraussetzungen
- Simulation: Mehrere Box-Prozesse mit unterschiedlichen
box_id.
- Durchfuehrung – Simulation / Emulation
- Nicht testbar mit aktuellem Code: Announce/Server-Erkennung fehlt.
- Durchfuehrung – Reale Box (Hardware)
- Nicht testbar mit aktuellem Code.
- Erwartetes Ergebnis
- Nicht testbar mit aktuellem Code.
- Abweichungen / Fehlersuche
- Wenn implementiert: Pruefe Duplikate anhand
box_idundfingerprint.
Test M: Pairing-Freigabe ueber Server-GUI
- Ziel
- Box wird nach Freigabe gepairt und erhaelt API-Token.
- Voraussetzungen
- Simulation: Server-GUI und Pairing-Endpunkte implementiert.
- Durchfuehrung – Simulation / Emulation
- Nicht testbar mit aktuellem Code: Pairing-Flow fehlt.
- Durchfuehrung – Reale Box (Hardware)
- Nicht testbar mit aktuellem Code.
- Erwartetes Ergebnis
- Nicht testbar mit aktuellem Code.
- Abweichungen / Fehlersuche
- Wenn implementiert: Pruefe Token-Speicherung in
box/data/secrets.enc.
Test N: Verhalten vor Pairing (keine Steuerung erlaubt)
- Ziel
- Vor Pairing sind Steuerbefehle blockiert.
- Voraussetzungen
- Server-Integration und Auth-Checks vorhanden.
- Durchfuehrung – Simulation / Emulation
- Nicht testbar mit aktuellem Code: kein Auth/Pairing implementiert.
- Durchfuehrung – Reale Box (Hardware)
- Nicht testbar mit aktuellem Code.
- Erwartetes Ergebnis
- Nicht testbar mit aktuellem Code.
- Abweichungen / Fehlersuche
- Wenn implementiert: Pruefe API-Responses (401/403) und Server-Logs.
Test O: Verhalten nach Pairing
- Ziel
- Nach Pairing sind Steuerbefehle erlaubt und Box reagiert.
- Voraussetzungen
- Pairing-Flow implementiert.
- Durchfuehrung – Simulation / Emulation
- Nicht testbar mit aktuellem Code.
- Durchfuehrung – Reale Box (Hardware)
- Nicht testbar mit aktuellem Code.
- Erwartetes Ergebnis
- Nicht testbar mit aktuellem Code.
- Abweichungen / Fehlersuche
- Wenn implementiert: Pruefe Token in
secrets.encund Server-GUI Status.
Test P: Neustart vor/nach Pairing
- Ziel
- Box behaelt Pairing-Status und Token ueber Neustarts.
- Voraussetzungen
- Pairing implementiert.
- Durchfuehrung – Simulation / Emulation
- Nicht testbar mit aktuellem Code.
- Durchfuehrung – Reale Box (Hardware)
- Nicht testbar mit aktuellem Code.
- Erwartetes Ergebnis
- Nicht testbar mit aktuellem Code.
- Abweichungen / Fehlersuche
- Wenn implementiert: Pruefe
secrets.encvor/nach Neustart.
Test Q: Factory Reset -> neue Identitaet
- Ziel
- Factory Reset loescht box_id und erzeugt neue Identitaet beim naechsten Start.
- Voraussetzungen
- Box laeuft einmalig und
box/data/existiert.
- Durchfuehrung – Simulation / Emulation
- Stoppe Box.
- Loesche folgende Dateien:
rm -f box/data/box.json box/data/state.json box/data/secrets.enc
- Starte Box neu:
python3 box/main.py run
- Pruefe
/status.
- Durchfuehrung – Reale Box (Hardware)
- Nicht testbar mit aktuellem Code: kein Factory-Reset-Mechanismus implementiert.
- Erwartetes Ergebnis
- Neue
box_iderscheint in/status.
- Abweichungen / Fehlersuche
box_idbleibt gleich: Dateien wurden nicht geloescht.
Test R: Offline / Server nicht erreichbar
- Ziel
- Box laeuft weiter, wenn Server nicht erreichbar ist.
- Voraussetzungen
- Server-Integration implementiert.
- Durchfuehrung – Simulation / Emulation
- Nicht testbar mit aktuellem Code: keine Server-Kommunikation.
- Durchfuehrung – Reale Box (Hardware)
- Nicht testbar mit aktuellem Code.
- Erwartetes Ergebnis
- Nicht testbar mit aktuellem Code.
- Abweichungen / Fehlersuche
- Wenn implementiert: pruefe lokale Funktionen (Playback, NFC) laufen weiter.
Test S: Simulation vs. Hardware – Unterschiede
- Ziel
- Dokumentiere, was real vs. mock ist.
- Voraussetzungen
- Box laeuft in Simulation.
- Durchfuehrung – Simulation / Emulation
- Beachte: WiFi/IP/Spotify/Audio sind Mock.
- Setup UI und API funktionieren lokal.
- Durchfuehrung – Reale Box (Hardware)
- Nicht testbar mit aktuellem Code: Hardware-Backends fehlen.
- Erwartetes Ergebnis
- Simulation laeuft ohne Hardware.
- Hardware-Backends koennen spaeter ersetzt werden.
- Abweichungen / Fehlersuche
- Wenn Hardware genutzt wird, fehlen Implementierungen.