Test your SaaS replacement before cancelling the original
By Flavio
Updated
Tagged: Business
Run a homemade SaaS replacement beside the original with read-only inputs, compare real outputs, and rehearse recovery before switching over.
Don’t cancel the old tool the day you build a replacement. Keep it running while you test your own version next to it.
That overlap lets you catch missing edge cases calmly instead of turning every bug into an emergency. In build versus buy, I talked about what you end up owning when you roll your own software. This post is about the step right before you take that on: comparing outputs until you know your replacement holds up.
We’ll walk through this with a reporting tool that summarizes invoices. The old service stays in charge of entering invoices. Your replacement only reads copies and generates the same report. It can’t charge anyone or send messages.
Give the trial a finish line
Before you start comparing anything, write down what the replacement has to handle, especially the awkward cases that show up in your real work.
For an invoice report, cover a normal invoice, a refund, a foreign-currency invoice, and a corrected record. Throw in an empty period too, plus enough rows that the code has to paginate through multiple pages instead of grabbing everything in one request.
Next, decide what needs to match between the two reports. Invoice IDs, totals, currencies, and statuses usually have to line up. The timestamp of when the report was generated can differ without changing what the numbers mean.
Then put a review date on the calendar. A couple of weeks is plenty if a full reporting cycle happens in that window. If you only bill quarterly, two quiet weeks won’t tell you much. Tie the trial to a real event like a quarter close instead of picking a random number of days.
Keep one system responsible for writes
While the trial is running, keep all writes in the old system. Enter new invoices there and fix mistakes there. Feed your replacement with exports or a read-only API key.
Turn off any scheduled jobs in the replacement that send emails, charge cards, or update other services. Even better, run it in an environment with no credentials for those actions. That way, even if a “dry run” flag misses a code path, the request has nowhere to go.
Tag every data copy with a snapshot ID and a time range so both reports look at the exact same source data. If you compare yesterday’s export against today’s live account, you’ll chase down mismatches your replacement didn’t cause.
Save the inputs and outputs from each run in their own folder. When you fix a bug later, you’ll want to re-run the same comparison against the exact same snapshot.
Compare the meaning of the output
You don’t need a big testing setup for this. A small Node script built on the standard library is enough to check the fields you care about and flag missing or changed rows. It compares amounts in integer cents and lines up equivalent timestamps, so formatting quirks don’t drown out real mismatches.
Start by creating old.json with the output from the existing service:
[
{
"id": "invoice_41",
"totalCents": "1250",
"currency": "EUR",
"status": "paid",
"issuedAt": "2026-10-15T10:00:00+02:00"
}
]
Then save the matching output from your replacement in new.json:
[
{
"id": "invoice_41",
"totalCents": 1250,
"currency": "EUR",
"status": "paid",
"issuedAt": "2026-10-15T08:00:00Z"
}
]
The script ignores row order and extra fields, so you can swap in whatever fields your own report needs. Save it as compare.mjs:
import { readFile } from 'node:fs/promises'
function normalize(rows) {
if (!Array.isArray(rows)) throw new Error('Expected an array')
const result = new Map()
for (const row of rows) {
if (!row || typeof row.id !== 'string' || !row.id) {
throw new Error('Every invoice needs an ID')
}
if (result.has(row.id)) throw new Error(`Duplicate ID: ${row.id}`)
const amount = row.totalCents
const validAmount = typeof amount === 'number' ||
(typeof amount === 'string' && /^-?\d+$/.test(amount))
const totalCents = validAmount ? Number(amount) : NaN
if (!Number.isSafeInteger(totalCents)) {
throw new Error(`Invalid cents for ${row.id}`)
}
for (const field of ['currency', 'status']) {
if (typeof row[field] !== 'string' || !row[field]) {
throw new Error(`Missing ${field} for ${row.id}`)
}
}
const date = typeof row.issuedAt === 'string'
? Date.parse(row.issuedAt)
: NaN
if (!Number.isFinite(date)) {
throw new Error(`Invalid date for ${row.id}`)
}
result.set(row.id, {
totalCents,
currency: row.currency,
status: row.status,
issuedAt: new Date(date).toISOString()
})
}
return result
}
const [oldPath, newPath] = process.argv.slice(2)
if (!oldPath || !newPath) {
throw new Error('Run: node compare.mjs old.json new.json')
}
const oldRows = normalize(JSON.parse(await readFile(oldPath, 'utf8')))
const newRows = normalize(JSON.parse(await readFile(newPath, 'utf8')))
const ids = [...new Set([...oldRows.keys(), ...newRows.keys()])].sort()
const differences = []
for (const id of ids) {
const oldValue = oldRows.get(id) ?? null
const newValue = newRows.get(id) ?? null
if (JSON.stringify(oldValue) !== JSON.stringify(newValue)) {
differences.push({ id, old: oldValue, new: newValue })
}
}
console.log(JSON.stringify({ differences }, null, 2))
process.exitCode = differences.length ? 1 : 0
Now run the comparison from your terminal:
node compare.mjs old.json new.json
That prints an empty differences array. Both timestamps point to the same moment in time, and both amounts come out to 1250 cents.
Try changing the replacement’s amount to 1300 and running it again. This time the script exits with an error status and prints both values for invoice_41. If you delete that row altogether, it flags the missing record with new: null.
This script assumes your exports include valid timestamps with timezones. Check your vendor’s date format before reusing it, because Date.parse() accepts plenty of inputs you might not want. Keep accounting rules like how refunds and credits are represented inside your adapter, and don’t quietly round decimal amounts into cents without a clear rule behind it.
Investigate differences before changing the comparison
When the two reports don’t match, dig into the reason before you touch the comparison script. Maybe your replacement dropped a refund, or maybe the old tool puts refunds into a different billing period. Figure out which behavior you want before deciding which side is right.
Write the reason down right next to the comparison output. If a difference is fine, write down the rule that allows it and add a concrete test case for it. Don’t toss in a loose filter just to get a green run.
Keep track of manual babysitting too. If the numbers match only because you had to fix a broken import every morning, that’s not the same as a report that runs on its own. Count every failed run and note how much time you spent debugging it.
Test what happens when the source API goes down. Your replacement needs to catch the failed refresh and keep the last good report along with its original timestamp. Showing yesterday’s numbers as if they were fresh makes historical checks look great while quietly misleading you in production. Once access comes back, run the recovery check too and make sure it catches up cleanly.
Rehearse the switch with a copy
Before you flip anything for real, do a dry run on a clean copy. Export your data from the old service, load it into a fresh instance of your replacement, and open the generated report along with a handful of individual records. Spot-check attachments and older reporting periods while you’re in there, and stash a separate backup of the export somewhere safe.
Before switching, map out what new data gets created afterward and how you’d move it back to the old system if you reverse course. With a read-only reporting tool, rolling back is straightforward because the source invoices never moved. If you were replacing the invoicing system itself, you’d need a much more careful migration plan.
Pick one clear moment to turn off the old scheduled report and turn on the new one, then look inside both tools to confirm the old job is paused and the new one is active. You can leave the old account open as a safety net without having both automations firing at once.
Cancel after the comparison answers your questions
When your review date arrives, look over what passed, what still doesn’t match, and how much time you spent keeping the replacement running. That gives you enough to either make the switch, extend the trial for a specific case that didn’t come up yet, or stick with the service you already pay for.
If you decide to cancel, read the vendor’s export and access rules first. Grab every record and piece of documentation you might need while your login still works. Cancelling often just stops the next renewal rather than shutting the account down right away, so check the billing page afterward to see what state your account is in.
And if you end up keeping the subscription, the trial wasn’t wasted. Now you know what the vendor is doing under the hood and what a replacement would have to cover. Hold on to your test fixtures and comparison notes so if you ever take another run at it, you won’t be starting from zero.
Want me to talk about your product? You can sponsor this site.
Related posts about business: