Skip to main content

Interop Service — Testing Strategy

Status: populated Owner: TBD Last updated: 2026-04-18 Companion: Service Template · 03 platform-services · 02 DDD


1. Coverage Targets

LayerTarget
Unit≥ 80% statement coverage
IntegrationAll use cases and message types covered
ContractAll FHIR interactions (FHIR conformance); management API (Pact)
E2EADT inbound → Patient updated; ORM outbound; ORU inbound; bulk export round-trip

2. Mandatory Tests

Test fileCoverage
test/integration/tenant-isolation.spec.tsCross-tenant FHIR access blocked; HL7 messages scoped
test/integration/outbox.spec.tsHL7 processing events published to NATS
test/integration/inbox.spec.tsOutbound HL7 trigger from NATS event

3. Unit Test Scenarios

ModuleScenarios
Hl7ParserADT A01/A03/A08/A40; ORM O01; ORU R01; VXU V04; malformed MSH
AdtMapperA01 → Patient + Encounter FHIR create; A08 → update; A03 → discharge; A40 → merge
OruMapperORU^R01 → Observation + DiagnosticReport FHIR
OrmMapperServiceRequest → ORM^O01 HL7
FhirRouterRoute by resource type + category; fan-out merge; routing rule priority
ProfileValidatorUS Core 6.1 required field validation; AFG-Core extension validation
BulkExportWorkerExport lifecycle state machine; partial failure handling
Hl7MessageDeduplicatorSame message control ID → idempotent

4. Integration Test Scenarios

ScenarioDescription
ADT A01 inboundReceive ADT^A01 MLLP; assert Patient + Encounter created; event published
ORU R01 inbound → lab resultReceive ORU^R01; assert Observation posted to laboratory-service
ORM outbound from order eventConsume clinical.orders.placed; assert ORM^O01 sent to connector
VXU V04 inboundReceive VXU^V04; assert Immunization created via immunizations-service
Duplicate message control IDSame ORU twice; assert second is deduplicated
FHIR read routingGET /fhir/R4/Observation?category=laboratory routed to laboratory-service
FHIR fan-out searchGET /fhir/R4/Observation?patient=... (no category) → fan-out to all Observation owners
ABAC denialExternal client without patient access → 403 OperationOutcome
Bulk $export round-tripInitiate export; poll; download NDJSON; assert resource count
Owning service unavailableTarget returns 503 → gateway returns 503 OperationOutcome
Profile validation failureResource missing required field → 422 OperationOutcome

5. Contract Tests

ContractType
GET /fhir/R4/metadataFHIR CapabilityStatement conformance
GET /fhir/R4/Patient/{id}Pact provider + FHIR conformance
GET /fhir/R4/ObservationPact provider
interop.hl7v2.adt.received schemaJSON schema — registration-service consumer
interop.hl7v2.oru.received schemaJSON schema — laboratory-service consumer

6. E2E Scenarios

ScenarioPriority
External FHIR client reads patient dataP0
ADT A01 triggers patient registration updateP0
ORU^R01 results appear in clinician chartP0
Bulk export produces valid NDJSON for all resource typesP1
ABAC-scoped portal FHIR reads return only permitted dataP1