back

by WolfOliver·2y ago·view on hn ↗
It is the safest way to make sure your test will actually fail in case your code does not work. I often had the situation where I wrote a test which is always green, if if the code is broken.

Often I do not have the clarity to write the test first, then I just write the code and the test later. But I comment out the code or introduce a bug on purpose to make sure when I run the test code it actually works and detects the bug.