Should You Let AI Write Your Tests? An Honest Take
Yes, but only for the parts that don't decide whether your code is correct. AI is excellent at the mechanical layer of testing: scaffolding, mocks, boilerplate, filling coverage gaps. It's dangerous the moment it writes the assertions , because it tends to test what the code does, not what the code should do. That distinction is the whole argument. I've been letting AI write tests on real projects for months now, and my opinion landed somewhere uncomfortable for both camps. The “never let a robot near your tests” crowd is wrong. So is the “generate the whole suite and move on” crowd. The truth is in the boring middle, and it took a few bugs slipping through green test runs for me to see exactly where the line sits. What does AI actually do well in testing? AI shines at the repetitive, low-judgment parts of a test file: setup, teardown, mock wiring, fixtures, and the dozen near-identical cases you'd otherwise copy-paste. In my testing, this is where it save...