Published: August 18, 2022 • 2 min read
When testing user input or data presentation, I prefer using realistic rather than random data.
This might sound obvious, but it’s something I see done a lot of different ways.
The behavior I’m describing: when testing forms, data presentation, or even seeding data, a programmer will use gibberish or insider-y jargon.
An example might be an address form, where the programmer types some combination of the letters ‘asdf’ for each field. In this case, I think it’s preferable to enter ‘123 Main St.’ or similar into the first address field, and likewise for the other fields.
Or a CMS field, where the programmer might type ‘Customer Header Test’ into the default field. In this case, I think it’s preferable to put ‘Dashboard’ or ‘Welcome!’ there.
Or seed data, where every customer’s email is ‘email@example.com’. I’ve explored foo recently. Here, a series of generated realistic emails makes the data easier to work with and talk about.
Why does this matter? I think realistic data stresses the software in realistic ways, is more pleasant to work with, and feels more polished.
Real data stresses the software realistically. Perhaps your template doesn’t display gibberish well. Is that worth solving? Perhaps not.
Real data is more pleasant to work with. I prefer to look at a website, even in development, with data that looks real. It helps me understand the user experience.
Lastly, real data feels polished. I share a lot of screenshots with my team. I prefer that they look real rather than feature keyboard smashes and stream-of-consciousness nonsense. You never know where a screenshot from your dev environment might end up.
The counterargument is that it takes a little more time to think of something realistic to type. I think that tiny amount of time is always worth it. You get better at it.
✉️ Get better at programming by learning with me. Subscribe to Jake Worth's Newsletter for bi-weekly ideas, creations, and curated resources from across the world of programming. Join me today!
Blog of Jake Worth, software engineer in Maine.