Engineering2026-07-21

How I Generate Test Data Without Leaking Real Customer Info

I once found production credit card numbers in a test database. Never again. Here\x27s how I build realistic dummy data that doesn\x27t put anyone at risk.

Here's a confession: early in my career, I tested a payment flow using my own credit card. Real number. Real expiry. Real CVV. I was 22, I was alone on a Friday night, and I thought, "What could go wrong?"

I still have nightmares about that CSV file floating around somewhere.

These days I'm a little more careful. Actually, a lot more careful. Getting burned by your own stupidity once is enough.

The Problem With Real Data

When you're building an app that processes payments, manages accounts, or stores personal info, you need realistic test data. Fake names. Fake emails. Fake credit card numbers that look valid but aren't. The problem is, most developers reach for the easiest option: dump production data into a test environment and call it a day.

This is how breaches happen. This is how you end up on the front page of Hacker News with a headline that starts with "Unsecured Database Exposes..."

My Current Setup

I use two tools in combination, and they've completely changed my workflow.

First, the UUID generator. Every test user in my system gets a UUID instead of an auto-incrementing ID. Why? Because UUIDs don't leak information. They don't tell you how many users I have, or which one signed up first, or any of the other metadata that sequential IDs accidentally reveal. Plus they make my test DB feel fancy and futuristic.

Second — and this is the real game-changer — I use the test credit card generator (yeah, we have one). It generates numbers that pass the Luhn algorithm check (so they look real enough for validation logic), but they come from known test ranges. Visa test numbers start with 4. MasterCard with 5. None of them will actually charge anyone. I've set up my CI pipeline to generate fresh card numbers for every test run. No storage, no risk, no stress.

Beyond Cards and IDs

For the rest of my test data, I use a similar philosophy. Fake names from random name generators. Email addresses that route to a catch-all test domain. Addresses from the USPS's official list of fictional addresses (yes, that exists — the post office is surprisingly accommodating to pretend scenarios).

The golden rule: if it could be a real person's data, it shouldn't be in your test DB. That includes your Aunt Linda's phone number, your old roommate's email, or — dear god — your own credit card.

You Don't Need to Be Paranoid, Just Careful

I'm not saying you need a full security audit just to run a unit test. But taking five minutes to generate proper test data — using a UUID generator here, a test card generator there — is the difference between a safe development workflow and a disaster waiting to happen. And honestly, it's more fun. Fake data means you can give your test users names like "Crash Override" and "Acid Burn" without getting sued.

Trust me. Your future self — and your customers — will thank you.