Automated testing for Mirth Connect channels in a CI/CD pipeline replaces the usual promotion rule: someone sent one message by hand and liked the result. The next message, the one missing a field, is the one that reaches a live system.
The approach is for hospital CTOs, CIOs and digital health founders who want interface changes to go through the same gate as their other code. You get the sample messages a pack needs, the acknowledgment each must receive, a pass-through check, and where the pack sits before production import.
What belongs in an automated test pack for a Mirth Connect channel?
An automated test pack for a Mirth Connect channel is a set of sample messages, the acknowledgment each sample must receive, and a comparison that fails if a pass-through channel changes the message. Agnotic Technologies runs that pack on a non-production engine before the channel is imported to production.
Add tests to your Mirth Connect channels
Our Mirth Connect page covers channel builds and the test packs we leave behind them.
The pack is files and a runner, not a meeting. The runner starts the channels under test, sends each sample, reads the acknowledgment, reads the outbound message, and compares both to the expected files. A human still owns the samples. The runner only refuses to promote a channel that misses them.
NIST SP 800-218, the Secure Software Development Framework, groups secure development practices into four areas: prepare the organization, protect the software, produce well-secured software and respond to vulnerabilities.
Produce well-secured software, in that framework, includes testing before release. For an interface channel the release is the import onto the engine that talks to real systems. The pack is the test that belongs in front of that import.
Which sample messages should the pack include?
Include one accepted message, one message the agreement says must be rejected, and one message for every branch the channel claims to handle. Build the samples. Do not paste a production message into the repository.
- Accepted: every required field populated, matching the interface agreement, with fictional identifiers.
- Rejected: one required field removed, so the channel has to take the failure path the agreement describes.
- Branch: a second accepted message only where the channel truly behaves differently, such as a second destination.
- Unchanged: a copy of the accepted message used again for the pass-through comparison, so the two checks cannot drift apart.
Name each file for the case, not for the date you made it. Store the expected acknowledgment beside the sample, and store the expected outbound message beside it too. A sample with no expected file is a demo, not a test.
What acknowledgment should a test expect?
Expect the acknowledgment code the interface agreement names, and expect the message control id in the acknowledgment to match the control id of the sample you sent. A test that only checks that some bytes came back will pass when the engine rejected the message.
- Success case: the success code from the agreement, and the sample's control id echoed back.
- Failure case: the error code from the agreement, not a success code with an error buried in a note.
- Filtered case: the code you promised the sender for a message you accepted and chose not to forward. Write that code down. Guessing it in the test hides a retry loop later.
- Timeout: the runner fails the test if no acknowledgment arrives within the wait you set. Silence is not a pass.
Keep the expected acknowledgment as a file a reviewer can read. When the agreement changes, that file changes in the same commit as the channel. The runner diffs. It does not interpret clinical meaning.
How do you test a channel that must not change the message?
Compare the outbound message to the inbound sample after you normalize line endings. Any added field, missing field or reordered field fails the test. This is the check for a channel whose job is to forward, or to choose a destination, without editing.
- Send the accepted sample through the channel on the test engine.
- Capture the message the destination received, from a test destination that writes the bytes to a file.
- Normalize line endings and trailing separators you have agreed to ignore.
- Fail if the remaining text differs. Do not ignore a difference because it 'looks harmless'.
A channel that is allowed to change specific fields uses a different expected file, listing the outbound message in full. Check the whole outbound message, not only the field you meant to edit. Edits you did not intend are the ones this pack exists to catch.
Where do these tests sit in the pipeline?
The tests sit after the channel files are assembled and before those files are imported to the production engine. The pipeline step that would promote the channel runs the pack first. A failed pack stops the promotion.
- A non-production Mirth Connect instance, with the channels imported from the same files the pipeline would promote.
- The runner, sending each sample and comparing acknowledgments and outbound messages to the expected files.
- A hard stop: production import does not start when the pack fails.
- The same pipeline your other services already use. The interface channels are one more job in it, not a side process someone remembers to click.
The test engine is not a laptop with a hand-edited copy of the channel. If the files under test are not the files that would be imported, the pack is testing a different channel. Point the job at the artifact the promotion step uses.
What should a failed test stop?
A failed test stops the promotion of that channel to production. It can also stop the promotion of channels packaged with it, when they share one import. It should not stop unrelated channels that were not in the change.
- Fail closed on the channel that missed an acknowledgment or an outbound comparison.
- Leave the previous production version running. A failed test is not a reason to undeploy the live channel in the same job.
- Write the failing sample name and the diff into the job log, with no patient data, because the samples are fictional.
- Require a person to change the channel or the expected file. Rerunning the same files is not a fix.
Flaky tests get fixed or removed. A pack that fails on Tuesdays and passes on Wednesdays will be bypassed. If a test depends on the clock or on a shared environment, make it deterministic or drop it from the gate and say so.
How do you keep real patient data out of the pack?
Build samples from fictional identifiers, or from data that has been de-identified before it ever reaches the repository. A production message copied into the project is a disclosure, even when the repository is private.
HIPAA allows two ways to de-identify health data: expert determination, or the safe harbor method, which removes 18 categories of identifiers.
Safe harbor is one of the two HIPAA methods, and it removes eighteen categories of identifiers. A sample that still has a real medical record number, a real name, a real address or a real device id has not been through that method. Prefer a message you typed from the interface agreement. It is shorter to review, and it contains nothing to leak.
The HIPAA Privacy Rule's minimum necessary standard requires covered entities to limit uses and disclosures of protected health information to the minimum needed for the purpose.
The pack needs the fields the channel actually reads. It does not need a full clinical history in every sample. Minimum necessary applies to test data you store, not only to messages you send onward.
What will this pack not prove?
The pack proves that these samples produce these acknowledgments and these outbound messages on the test engine. It does not prove how much traffic the production server can carry, and it does not prove what happens when a server process stops.
- It does not measure messages per hour. Capacity is a reading you take on the engine that has the real volume.
- It does not replace a review of the interface agreement. The expected files encode the agreement. Someone still has to confirm they match it.
- It does not test the sender's network path into production. That check happens with the sender, against the address they will use.
- It does not prove a destination's clinical behavior beyond the bytes you captured. If the destination must file a chart, their team still has a test of their own.
What are the common mistakes with automated Mirth Connect testing?
- Checking only that an acknowledgment came back, not which code it carried or which control id it echoed.
- Testing a hand-edited copy of the channel on a laptop instead of the files the pipeline will import.
- Copying production messages into the repository as samples.
- Editing an expected file to make a red build green without a reason in the commit.
- Keeping a flaky test in the gate until the team learns to skip the gate.
How should the expected files be reviewed?
Review expected files the way you review code. The analyst who owns the interface agreement approves a change, and the reviewer reads the diff of the expected outbound message, not only the channel edit. An expected file edited to make a failing test pass needs a reason in the commit.
A worked example: a result channel gains one field
- Step 1, the interface agreement adds a performing lab field to the outbound message.
- Step 2, the analyst updates the expected outbound file for the accepted sample and adds a second sample where that field is empty.
- Step 3, the pipeline runs the pack, and the pass-through check on a neighbouring channel in the same import still passes.
- Step 4, the reviewer reads both diffs and approves, and only then does the production import start.
The neighbouring channel matters. It shares the import, so its unchanged result is the proof that the edit stayed inside one channel.
Which channels should run when a shared code template changes?
Every channel that includes the changed library, not only the channel that prompted the edit. Keep a list of which channels include which libraries, so the pipeline can pick the right packs without a person remembering.
How do you tell the pack is doing its job?
A failed run names a sample and a diff a reviewer can act on, and nobody skips the gate by hand. When a defect still reaches production, turn the message that caused it into a new fictional sample, so the same gap cannot pass twice.
How can Agnotic help you automate Mirth Connect channel tests?
Agnotic builds the sample set and the expected acknowledgments from the interface agreement, writes the runner, and puts it in the pipeline in front of production import. Test automation is the practice we use when the same pack has to run on every change, not only on the day of go-live.
Put channel tests in the pipeline
We will turn your interface agreement into samples, expected acknowledgments and a gate on deploy.
Related reading on Agnotic
Channel deployment, scripts and the HL7 feeds worth a repeatable test pack.


