What kinds of tests do you write for someone else’s code?
Hot take, but I take it back lightly: The more writing is done by the assistant for your project, the more your tests weigh as your knowledge of the code fades away.
For example, for a recent application to split expenses between friends, I let the assistant write the logic while creating three tests myself. First, to make sure that splitting an expense into three parts will result in even cents. Second, to check whether deleting a friend doesn’t break old expenses. Third, to test if an empty group won't cause any problems. All three tests helped me catch actual issues on the second day.
Creating the tests manually made me define the criteria of being right, which is something I cannot delegate. Whenever the assistant writes its own tests, it tends to validate what it has written before.
My approach is testing money, deletion, and emptiness, and letting the rest be manual clicks. It's a sparse web, but it traps the bugs that make you feel embarrassed in front of users.
What is your bare minimum? Do you go with assistant written tests, write them yourself, or forego them altogether in prototyping? And has there ever been a test that saved your project in an unexpected way?
Replies
I'd add a repeated-submit case: send the same expense twice, then check the group's balances. A double click or a retry should not turn one dinner into two debts, even if both requests return success.
Hi Ghost Kitty! I'm an aspiring app developer, and I'm also learning how to build applications with AI assistance.
I agree that manually writing tests is important because AI-generated code can still have hidden bugs. I'm curious: what tools or methods do you recommend for beginners who want to test AI-generated applications before releasing them to users?
@efrin_jae_raman Start with a small table of inputs and expected results you can calculate yourself. Ask the AI to turn those examples into tests, then deliberately break one calculation and check that a test fails. That gives you something concrete to review even while you're learning the code.