← Back to context

Comment by theshrike79

2 days ago

You don't do it for bugs, you do it for features in this case.

Contrived example: You want a program that prints out the weather for the given area.

First you write the tests (using AI if you want) that test for the output you want.

Then you tell the AI to implement the code that will pass the tests and explicitly tell it NOT to fuck with the tests (as Claude 3.7 specifically will do happily, it'll mock the tests so far it's not touching a line of the actual code to be tested...)

With bugs you always write a test that confirms the exact case the bug caused so that it doesn't reappear. This way you'll slowly build a robust test suite. 1) find bug 2) write test for correct case 3) fix code until test passes