Journal

Engineering

Breaking it on purpose

The failure paths customers actually hit cannot be reached with test data - validation stops the call before it fires. Testing them means cutting the wire.

3 min read

Application THE FIELD ERP BOOKING THE TEST CUTS HERE THE FAILURE IS CHOSEN, NOT AWAITED Order of calls 1 RESERVE 2 BOOK 3 CONFIRM THE ORDER IS AN INVARIANT, NOT AN ACCIDENT THE TEST CHECKS IT EVERY TIME
The test cuts the connection on purpose, then checks that the calls still run in the required order: reserve, book, confirm.

There is a class of bug that no amount of careful test data will ever find, and it lives in the most commercially sensitive part of a distribution system: the moment an order leaves our software and enters the customer’s ERP.

Here is the trap. You want to test how the app behaves when the ERP rejects a document - because one day it will: a locked posting period, a changed item card, a service mid-restart. So you construct a poisoned order, an item code that cannot exist. And nothing happens. Your own validation catches the fake item before the ERP call ever fires. The system is protecting itself against your test. The failure path you most need to see - request sent, remote side fails - is unreachable by data, because every layer you built to keep garbage out is doing its job.

Breaking the wire on purpose

The path is reachable by one method only: breaking the wire on purpose. Point the integration at an address where nothing listens. Kill the remote service mid-flight. Let the connection open and then starve it. Only then do you see what the rep will see on a Tuesday in a store with one bar of signal: does the document stay safely queued, does the app say something honest, does retry fire once or forty times, does anything get booked twice when the line comes back? What the connector does in each of those cases is described on the integrations page.

Checking the order of calls

That last question points at the second discipline, which is subtler than cutting wires: verifying the order of calls, not just their outcomes. An integration can pass every outcome-based test and still be wrong, because correctness lives in the sequence - reserve before book, book before confirm, never confirm what was not booked. A test that checks only “order ended up in ERP: yes” will bless a sequence that happens to work until latency reorders it. So the assertions worth writing are invariants: this call is never made before that one; this state is unreachable from that state. Sequence bugs found in production are the expensive kind, because they are timing-dependent, unreproducible on demand, and invisible in every log that records results without order.

A check must fail first

Both practices - severed connections and sequence invariants - come from the same conviction, and it is the same one that shows up elsewhere in how we work: a green test proves nothing unless you have watched it fail.

A check that has never been red is a decoration that runs, not a guard.

When we add a gate, we break the thing on purpose first, watch the gate catch it, then fix it back. The habit feels ceremonial until the day a gate you trusted turns out to have been measuring the wrong thing all along - a day everyone who builds software eventually gets, and after which the ceremony does not feel ceremonial anymore.

There is an honest cost to all this. Failure-path tests are annoying to build; they need environments you may switch off, network tricks, cleanup. The temptation is to postpone them because the happy path is where the features live and the demos happen. But field software earns its keep precisely where the happy path ends - at the edge of coverage, mid-ERP-maintenance, on the poisoned document. The customer never calls about the path that worked.

We would rather cut the wire ourselves, on a Wednesday morning with coffee, than have geography cut it for us during a go-live. It will be cut either way. The only variable is who is holding the scissors and whether anyone is watching what happens next. The controls around the integration itself, from roles to an audit trail on every change, are listed on the security page.

Engineering practices described are general; no client environment is identified.

The customer who isn't in the ERP

Field teams sell to customers the ERP has never heard of, and stop selling to customers the ERP still loves. What that gap taught us about explicit policies.