I spent a while changing retry logic in a tiny API client because my tests kept failing in different ways. It turned out the sample responses I had saved were inconsistent: one had a missing field, another had an old field name, and one was not even valid JSON.
After I cleaned up the fixtures, the actual client bug was pretty small. I am now treating test data as code instead of random files I happened to save.
1 reply
This is the kind of bug that makes you distrust your own notes for a while. I now keep JSON fixtures tiny on purpose, because once they get...
This is the kind of bug that makes you distrust your own notes for a while. I now keep JSON fixtures tiny on purpose, because once they get large it’s too easy for one stale field to hide the real problem.
Tiny fixtures helped a lot here too. I was trying to be clever by saving “realistic” responses, but realistic is how you end up debugging old mistakes instead of current code.