Menu

Post image 1
Post image 2
1 / 2
0

I Stopped Writing Database Fixtures by Hand. Here's What I Do Instead.

DEV Community·Jitendra Devabhaktuni·about 1 month ago
#xJ5rQMxv
#ai#webdev#database#testing#production#real
Reading 0:00
15s threshold

I'll be honest with you. For the longest time, writing database fixtures was just something I accepted as part of the job. You build a feature, you write the tests, you write the fake data the tests run against. Nobody loves doing it. Nobody complains loudly enough to change it. It just becomes part of the rhythm. Then I inherited a codebase where the fixtures hadn't been touched in two years. The schema had changed eleven times. Half the foreign keys in the fixture files pointed to IDs that no longer existed. Date fields were hardcoded to 2022, which meant every piece of logic tied to account age or subscription tenure was silently returning wrong results. The tests were green. The data was completely detached from anything resembling reality. That was the moment I decided to actually fix this instead of patch it again. The Problem With Handwritten Fixtures Nobody Talks About The obvious problem is that fixtures go stale.…

Continue reading — create a free account

Join HashtagPLUS to read full articles, follow hashtags, vote, and join the conversation.

Read More