Hacker News new | ask | show | jobs
by nivenhuh 841 days ago
I've used ChatGPT to write my tests. It's pretty effective at getting the first 5-6 use cases written out, but in a style that isn't correct. Copy/paste a code module, ask it to write the tests.

Then, in the same context, you correct it by providing it with more information about how you like to structure the tests. It starts to understand the "style".

Then, you start to provide the context with testing concerns. By the end of it, the AI context is pretty good (80-90'ish%).

It's nice, as a developer, to be able to say: "test that asset is deleted when DELETE /asset/:id", and the AI converts that into a proper test case, using familiar variables / test structure / corrects the abbreviated text into a proper test title, etc..