Some checks failed
Tests / Go Tests (push) Has been cancelled
Tests / Python Tests (push) Has been cancelled
Tests / Integration Tests (push) Has been cancelled
Tests / Go Lint (push) Has been cancelled
Tests / Python Lint (push) Has been cancelled
Tests / Security Scan (push) Has been cancelled
Tests / All Checks Passed (push) Has been cancelled
Security Scanning / Secret Scanning (push) Has been cancelled
Security Scanning / Dependency Vulnerability Scan (push) Has been cancelled
Security Scanning / Go Security Scan (push) Has been cancelled
Security Scanning / Python Security Scan (push) Has been cancelled
Security Scanning / Node.js Security Scan (push) Has been cancelled
Security Scanning / Docker Image Security (push) Has been cancelled
Security Scanning / Security Summary (push) Has been cancelled
CI/CD Pipeline / Go Tests (push) Has been cancelled
CI/CD Pipeline / Python Tests (push) Has been cancelled
CI/CD Pipeline / Website Tests (push) Has been cancelled
CI/CD Pipeline / Linting (push) Has been cancelled
CI/CD Pipeline / Security Scan (push) Has been cancelled
CI/CD Pipeline / Docker Build & Push (push) Has been cancelled
CI/CD Pipeline / Integration Tests (push) Has been cancelled
CI/CD Pipeline / Deploy to Staging (push) Has been cancelled
CI/CD Pipeline / Deploy to Production (push) Has been cancelled
CI/CD Pipeline / CI Summary (push) Has been cancelled
ci/woodpecker/manual/build-ci-image Pipeline was successful
ci/woodpecker/manual/main Pipeline failed
All services: admin-v2, studio-v2, website, ai-compliance-sdk, consent-service, klausur-service, voice-service, and infrastructure. Large PDFs and compiled binaries excluded via .gitignore.
4.0 KiB
4.0 KiB
H5P Service Tests
Übersicht
Das H5P Service Modul verfügt über umfassende Integration Tests, die alle Endpoints und Content-Typen validieren.
Test-Coverage
Module
- Server Endpoints: Health, Info, Editor Selection
- 8 Content Type Editors: Quiz, Video, Presentation, Flashcards, Timeline, Drag & Drop, Fill Blanks, Memory
- 8 Content Type Players: Interaktive Player für alle Content-Typen
- Static Files: Korrekte Bereitstellung von Editoren, Players und Assets
- Error Handling: 404-Behandlung für ungültige Routen
Tests ausführen
Lokal
cd h5p-service
npm install
npm test
Im Docker Container
# Service starten
docker compose -f docker-compose.content.yml up -d h5p-service
# Tests ausführen
docker compose -f docker-compose.content.yml exec h5p-service npm test
Test-Dateien
| Datei | Beschreibung |
|---|---|
h5p-service/tests/server.test.js |
Integration Tests für alle Endpoints |
h5p-service/tests/setup.js |
Jest Test Setup & Configuration |
h5p-service/jest.config.js |
Jest Configuration |
Coverage Reports
Nach dem Ausführen der Tests:
# HTML Report öffnen
open h5p-service/coverage/lcov-report/index.html
Coverage-Ziel: >80%
Test-Kategorien
1. Health & Info Tests
- Service-Verfügbarkeit
- Health Check Endpoint
- Service Info Page
2. Editor Selection Tests
- Alle 8 Content-Typen sichtbar
- Korrekte Links zu Editoren
- UI-Elemente vorhanden
3. Content Type Tests
Für jeden der 8 Content-Typen:
- Editor lädt korrekt
- Player lädt korrekt
- Erforderliche UI-Elemente vorhanden
Content-Typen:
- Quiz (Question Set)
- Interactive Video
- Course Presentation
- Flashcards
- Timeline
- Drag and Drop
- Fill in the Blanks
- Memory Game
4. Static File Tests
- Core Files erreichbar
- Editor Files erreichbar
- Player Files erreichbar
5. Error Handling Tests
- 404 für ungültige Routes
- Fehlerbehandlung für fehlende Editoren/Players
CI/CD Integration
Die Tests sind in die CI/CD Pipeline integriert:
# .github/workflows/tests.yml (Beispiel)
name: H5P Service Tests
on: [push, pull_request]
jobs:
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Start H5P Service
run: docker compose -f docker-compose.content.yml up -d h5p-service
- name: Wait for Service
run: sleep 10
- name: Run Tests
run: docker compose -f docker-compose.content.yml exec h5p-service npm run test:ci
- name: Upload Coverage
uses: codecov/codecov-action@v3
with:
files: ./h5p-service/coverage/lcov.info
Test-Qualität
Best Practices
- Isolation: Jeder Test ist unabhängig
- Cleanup: Keine persistenten Änderungen
- Assertions: Klare Expectations
- Speed: Tests laufen schnell (<10s gesamt)
- Reliability: Tests sind deterministisch
Code Review Checklist
Bei neuen Features:
- Tests für neue Endpoints hinzugefügt
- Coverage bleibt >80%
- Tests sind dokumentiert
- CI/CD Tests bestehen
Troubleshooting
Tests schlagen fehl
Service nicht erreichbar:
# Service Status prüfen
docker compose -f docker-compose.content.yml ps
# Logs ansehen
docker compose -f docker-compose.content.yml logs h5p-service
Port-Konflikte:
# Prüfe, ob Port 8003 belegt ist
lsof -i :8003
# Stoppe andere Services
docker compose -f docker-compose.content.yml down
Veraltete Dependencies:
cd h5p-service
rm -rf node_modules package-lock.json
npm install
Zukünftige Erweiterungen
- E2E Tests mit Playwright
- Content Validation Tests
- Performance Tests
- Security Tests (XSS, CSRF)
- Load Tests
- Visual Regression Tests