Skip to content
The Path

Module 5 · The integrator’s job·10 min

Testing an interface

Test sets, validation, test environment and acceptance.

An interface that works on the developer’s laptop proves nothing. It has to work with your codes, your identifiers, your odd cases, and fail cleanly when a message is bad. Testing means hunting for those surprises before the patients meet them.

Here is a test message for the interface between the hospital record and the sleep lab. The patient is fictional, and it shows. Click Edit, clear PID-3, and watch the validation react.

No issues found.

A test admission to the sleep lab. Obviously fictional patient, message marked T (training) in MSH-11.

ADT^A01^ADT_A01· Patient admit
||||||||||
||
||||||||
|||||||

A separate test environment

You do not test in production. You need a test environment: a copy of the hospital record, a copy of the lab software, a test channel in the interface engine. Addresses and ports differ from production, and are documented. Also check that its code tables, doctors and departments keep up with production: a test environment that drifts lets tests pass that will break in production.

MSH-11 (Processing ID) says how the message should be processed. HL7 table 0103 lists P (production), D (debugging) and T (training). The receiver checks it as part of its basic checks: if the value does not suit its process, it rejects the message with an AR (a CR in enhanced acknowledgement mode). The specification must say which value is used in test. A test message marked P passes that check quietly, and that is precisely the danger.

Fictional test sets

A test set is a list of chosen messages, each with its expected result. Patients are invented, and visibly so: TEST^Sleep, numbers in the 9000xx range, a round date of birth. Nobody should be able to mistake them for a real patient.

If you start from real messages to reproduce a case, anonymize them before they leave production. Name, date of birth, address, identifiers, and above all the free text of reports. The security lesson covers this in detail.

The happy path, then everything else

The happy path is the perfect message that flows from end to end. It is necessary, not sufficient. Here is a starter test plan:

Case What you send Expected result
Normal admission Complete A01 Patient created, AA acknowledgement
Update A08 changing the address Address updated, no duplicate
Empty required field A01 without PID-3 AE or AR acknowledgement, visible error
Unknown code Patient class not in the table Message in error, alert
Duplicate Same MSH-10 sent twice No second patient created
Accented characters Name with é, è, ç Accents intact on screen
Merge A40 Records linked in the target system
Receiver down Send during an outage Messages queued, sent on restart
Full result Polysomnography ORU^R01 AHI readable, right unit, right patient
Out of order A08 sent before the A01 Behaviour set by the specification: blocked or visible error
Cancellation A11 after an A01 Admission cancelled at the lab
Corrected result ORU with OBX-11 = C The corrected result replaces the first, no duplicate
Clearing A08 with "" in a field Value cleared on the target, not the text "" on screen
Large report PDF report encoded in OBX-5 Complete, readable document
Reserved character Text with & escaped as \T\ The & shows, not \T\

Each row has an expected result written before the test. Otherwise you end up calling normal whatever you happen to see.

Validating against the specification

A message can be correct by HL7 and wrong for your project. So you validate on two levels:

  1. The standard: segments in the right order, required fields present, data types respected.
  2. The specification: the profile’s R and RE usages, local table codes, expected Z-segments, the MSH-18 value.

The second level catches most real problems. It can only come from the document signed with the vendor.

Tools, by family

Family What it is for Examples
Message editor and validator Read, edit and check a message by hand NIST v2 validation tools
Simulator Play the sender or receiver that does not exist yet an Open Integration Engine channel
Interface engine test channel Replay messages, see each transformation step your own engine
Profile testing platform Test an IHE profile with other vendors Gazelle (IHE Europe)
Network analyser See the MLLP bytes actually on the wire Wireshark
Receiver log Check what was actually stored the target system

Not an exhaustive list, free tools first.

On this site, the Builder lets you build and validate a test message, and the Debugger takes a received message apart. They are learning and first-look tools, not conformance validators.

Acceptance with the clinical team

The last step is not technical. You bring in the users: physician, technologists, front desk. They run real-life scenarios with test patients and look at the screens. A field filled correctly but shown in the wrong place is still a failure.

Keep a record: scenario, date, result, open defects, signature. That acceptance report is the ticket to go-live.

And in FHIR?

Same logic. Public test servers and FHIR profile validators take the place of the v2 simulator and validator. Published profiles make validation against the specification more automatic.

Check your understanding

1 of 4

To test the sleep lab interface, a colleague suggests exporting 200 real records from yesterday. Your answer?

+50 XPPass the quiz (3 correct answers) to complete the lesson.

Reviewed and checked on 27 September 2026