2 Comments
User's avatar
Jelena Cupac's avatar

Do you have any tips for prompting AI to write good tests & code?

Expand full comment
Valentina Jemuović's avatar

Regarding writing good tests, to be honest, I didn't find any solution there yet. I've found that AI was generating meaningless tests. The only direction I see as helpful is writing better requirements, but then that's the same effort as writing the test itself.

However, for writing code that makes the test pass, that's where AI shines. Some prompts: "Can you make the test pass?", "Can you update file XYZ to make the test pass?". I also might add "Please implement only minimal code, not more than is needed to make the test pass."

Similarly for refactoring, I might ask "Can you refactor this code?", "How would you improve this code?"

Expand full comment