> One benefit of writing a test before fixing code is it avoids the problem of writing a test which passes but doesn't actually check the broken thing.
In fairness, this isn't an ironclad guarantee. I have written tests that misled me. That was educational.
These days I do some quick mutations of the test and the code I wrote before moving on. My anecdata is that it catches errors in my tests maybe 5% of the time.