The spreadsheet
The workbook held the whole pricing model: a tangle of nested formulas, conditional branches, tiered rules and thresholds. I reverse-engineered it into a structured rules engine inside a React single-page app written in TypeScript, so pricing became deterministic, testable code.
How the 73,750 test cases were built
An illustration in three cards: the sales pricing spreadsheet, a column of inputs above the prices it calculates; a table of test cases that multiplies each time one input changes; and the new pricing app, with a switch between the spreadsheet’s behaviour and the corrected rule. The five steps after it describe what happens.
I start with every input at its default. I copy those inputs and the prices the spreadsheet calculates, and that’s my first test case.
Then I change one input. Every case I already have gets copied with that change, and the spreadsheet gives me the new prices. A toggle doubles the cases; a dropdown with three options triples them.
I do that for every input. The real spreadsheet had many more inputs than these five, which is how the suite got to 73,750 test cases.
I wrote the app’s pricing logic to be correct, so some tests failed. Those failures led me to logic bugs in the spreadsheet itself.
The rollout had to match the spreadsheet exactly, so by default the app reproduces those bugs and every test passes. The fixes sit behind switches the sales team could turn on themselves.
Inputs and prices are illustrative.
Key decisions
How the tests reached 73,750
I started with every input at its base value and recorded those inputs and the spreadsheet’s prices as the first case. Then I moved one input to its next option and copied every existing case with that change, recording the new prices the spreadsheet calculated for each copy. A switch doubled the cases; a three-option dropdown tripled them. Repeating that for every input took the matrix to 73,750 cases, each one checking the engine against the spreadsheet’s output.
Parity first, even with the bugs
I wrote the engine with the pricing logic as it should work. When the parity tests compared it with the spreadsheet, some of the mismatches turned out to be logic bugs in the spreadsheet itself.
The rollout required exact parity anyway, so I added a bug-compatible mode that reproduces those defects, kept the corrected logic beside it, and put runtime switches between the two. The sales team could turn the corrections on themselves, without disrupting how they worked.
Instead ofFix the defects during the reimplementation. Parity was the requirement. Changing prices during the switch would have broken it.
Validated inputs
Inputs go through strict schema validation (Yup) before the rules run, and the same inputs always give the same price, across every tier, threshold and conditional path.
SendHub's code and screens are proprietary, so the images here are redrawn. Numbers are real unless marked as illustrative.