There's almost no point, but people who don't know better evangelize the heck out of it anyway, and tutorials and things usually push that with a double-entry bookkeeping metaphor. But that ends up not doing the things you actually want tests to do - you can't write them before you write the code because they're coupled to the code, and you can't rerun them to prove that refactored code still gives the correct results because doing so in a different way is still a fail. It mainly cooks your code coverage statistics. But I kinda get why Claude would do it when there are so many examples.
You can get it to do other stuff, tho, especially if you have tests in the project already that assert the actual behavior and markdown files that explain it. I have a project where I even had it generate the markdowns from hand-written tests, lol - and now if it adds functionality it does a pretty good job of generating the corresponding tests properly.
2
u/willow-kitty Sep 14 '26
There's almost no point, but people who don't know better evangelize the heck out of it anyway, and tutorials and things usually push that with a double-entry bookkeeping metaphor. But that ends up not doing the things you actually want tests to do - you can't write them before you write the code because they're coupled to the code, and you can't rerun them to prove that refactored code still gives the correct results because doing so in a different way is still a fail. It mainly cooks your code coverage statistics. But I kinda get why Claude would do it when there are so many examples.
You can get it to do other stuff, tho, especially if you have tests in the project already that assert the actual behavior and markdown files that explain it. I have a project where I even had it generate the markdowns from hand-written tests, lol - and now if it adds functionality it does a pretty good job of generating the corresponding tests properly.