Files
pi_mcps/java/mss-failsafe/.github/testing_strategy.instructions.md
T
Patrick Plate 1a0a56a626 chore(java): consolidate mss-failsafe to single canonical copy
Replace the stale multi-module java/mss-failsafe skeleton (old user-management
prototype) with the active single-module machine-safety inspection app that was
living in its own standalone repo at the repo root.

- Remove old java/mss-failsafe/ multi-module tree (mss, userdata, userManagement,
  mssfailsafe.datalayer, mssfailsafeWeblayer) incl. committed build artifacts
- Add the active app (PrimeFaces 11 / JSF 2.3 / Hibernate 5.6 / iText / POI)
  flattened into java/mss-failsafe/ as the only mss-failsafe in git
- Working tree captured = master tip 2a142b5 + in-progress uncommitted work
  (incl. .github/*.instructions.md AI-context files)
- Archive the standalone repo's 33-commit history in GIT_HISTORY_ARCHIVE.md
  since its .git was not migrated

This is the source of truth / base for the upcoming upgraded rewrite.
2026-06-13 19:55:28 +02:00

50 lines
1.7 KiB
Markdown
Executable File

# Testing Strategy Instructions
Aktualisiert: 2025-10-20
## Ziele
Testabdeckung für kritische Pfade: CRUD, Clone, Fragebogen Zuordnung, Fake-ID Mechanismus.
## Testarten
1. Unit Tests (reine Logik, z.B. createFakeID, Klon Copy-Konstruktoren).
2. Integration Tests (Persistence + Manager Methoden gegen Test-DB). Möglich mit in-memory H2 + angepasster persistence.xml.
3. UI/Controller Smoke Tests (Optional, z.B. mit Selenium/Arquillian Graphene).
## Prioritäten
- AbstractManager.save / saveAll Edge Cases.
- remove / removeAllIn (Null, nicht persistierte Entities).
- createFakeID Sequenz (-1, -2, -3 ...).
- Fragebogen Add/Remove Workflow (Wrapper Persistenz, Filterliste).
- Klonen tiefer Objektgraph.
## Beispiel Unit Test Fälle
- createFakeID(null) => -1.
- createFakeID(leere Liste) => -1.
- createFakeID([id=-1]) => -2.
- createFakeID([id=-3, id=-1]) => -4.
## Integration Tests (CRUD)
- Persist neue Entity -> ID != null.
- Merge vorhandene Entity -> unverändert Fachfelder korrekt übernommen.
- saveAll mit gemischten (neue + vorhandene) -> alle persistent.
## Fehlerpfade
- save(null) -> false.
- remove(null) -> false.
- remove(entity ohne ID) -> false.
## Klon Tests
- Quelle & Klon dürfen nicht gleiche ID haben.
- Child Collections tief kopiert (Referenzen ungleich, Werte gleich).
## Tooling Vorschlag
- JUnit 5, Mockito für isolierte Tests von Controller-Hilfsmethoden.
- Testcontainers (Optional später) für realistischere DB.
## Generator Leitplanken
- Für neue Fachlogik minimal 1-2 Unit Tests + 1 Integration Test.
- Keine Abhängigkeit auf Produktionspfade in Unit Tests; Test-spezifische Testdaten-Builder.
---