wiki/d-guides/testing-strategy.md
2026-04-06 00:46:32 +02:00

3.2 KiB

Testing-Strategie

Testpyramide

         /  E2E  \         <- Manuell / geplant
        / Functional \     <- Standalone-Scripts (AI, real calls)
       /  Integration  \   <- pytest (DB, Workflows, RBAC)
      /      Unit        \ <- pytest (Models, Utils, Logic)

Gateway: gateway/tests/

Test-Kategorien

Kategorie Pfad Beschreibung Ausfuehrung
Unit tests/unit/ Datamodels, RBAC-Logic, Utils, Workflows pytest tests/unit/
Integration tests/integration/ DB-abhaengig (RBAC, Workflow-Execution) pytest tests/integration/
Validation tests/validation/ Architektur-Validierung pytest tests/validation/
Functional tests/functional/ AI-Modell-Tests, KPI, JSON-Verarbeitung python tests/functional/<script>.py (standalone, nicht pytest)

Test-Verzeichnisstruktur

tests/
  conftest.py                         # sys.path Setup
  README.md                           # Ausfuehrungshinweise
  test_phase123_basic.py              # Root-Level Basistest
  unit/
    datamodels/                       # test_workflow_models, test_docref
    rbac/                             # test_rbac_bootstrap, test_rbac_permissions
    services/                         # test_renderer_pdf_smoke, test_json_extraction
    utils/                            # test_json_utils
    workflows/                        # test_automation2_graphUtils, test_state_management
  integration/
    rbac/                             # test_rbac_database
    workflows/                        # test_workflow_execution
  validation/
    test_architecture_validation.py
  functional/
    test01_ai_model_selection.py      # Nummerierte AI-Testscripts
    ...                               # test14_json_continuation_context.py etc.

Tests ausfuehren

cd gateway/

# Standard (ohne expensive-Marker):
pytest

# Alle Tests (inkl. expensive):
pytest -m ""

# Nur Unit:
pytest tests/unit/

# Mit Coverage:
pytest --cov=modules tests/unit/

Marker

  • @pytest.mark.expensive -- Standardmaessig uebersprungen (Default: -m 'not expensive' in pytest.ini)
  • @pytest.mark.asyncio -- Fuer async Tests

Konfiguration

pytest.ini im gateway/-Root:

  • testpaths = tests, pythonpath = .
  • Log-Output: logs/test_logs.log
  • Default: -v --tb=short -m 'not expensive'

Frontend Nyla

Aktueller Stand (2026-04-05): Kein automatisiertes Test-Framework installiert. package.json enthaelt keinen test-Script, keine Vitest/Jest/Cypress-Dependency.

Qualitaets-Gate: Nur ESLint (npm run lint).

Empfehlung: Vitest fuer Unit/Component-Tests, Playwright oder Cypress fuer E2E.

Akzeptanzkriterien (AC-Format)

In Work-Items (c-work/) verwenden wir Given-When-Then:

Given <Vorbedingung>
When <Aktion>
Then <erwartetes Ergebnis>

Testplan-Mapping

ID AC Art Automatisiert Repo-Pfad Status
T1 1 unit ja gateway/tests/unit/... pending
T2 2 integration ja gateway/tests/integration/... pending
T3 3 api nein -- pending

Referenz: -> c-work/_TEMPLATE.md (Testplan-Section)