Testing AI-generated code is the part almost everyone skips, and it's the part that decides whether an app can really be used. In this guide you'll find a testing method that works even if you don't program: test cases written in plain words, tests with another person's data, bad input, and a simple rule on who decides the app is ready.
Why an app written by AI needs testing
An app generated by AI usually seems to work on the first try. It opens, the buttons respond, the sample data shows up where it should. That's exactly the risk: it looks ready before it is.
AI writes code for the case you described. The problems are in the cases you didn't describe: the employee requesting time off that spans two years, the supplier uploading an empty file, the manager approving a request from another department. It's the difference between vibe coding, where you accept the result by eye, and software someone is willing to sign off on.
The problem with tests written by the same AI
Many tools also write tests when you ask for an app. It looks like a guarantee. Often it isn't.
If the same AI writes the code and the tests, the tests check the same assumptions as the code. If it misunderstood a rule, it gets it wrong in both places, and the tests pass anyway. It's like asking a student to grade their own homework: they won't necessarily cheat, but they don't see the mistakes they don't know they're making.
That's why testing needs at least two ingredients that the AI doing the building doesn't control:
- test cases chosen by a person who knows the work;
- a check by someone or something separate that didn't write the code.
How to write test cases, even without programming
A test case is a sentence: "if this happens, the app must do that". No code needed. What you need is to know the process.
- Take real cases. Three or four cases from last month, with real or realistic data. The ordinary requests and the ones that cost you time.
- Write the expected result before testing. If you write it afterwards, you tend to side with the app.
- Add edge cases. Dates spanning a month or year end, zero amounts, empty fields, names with an apostrophe, very large files.
- Keep some cases aside. Don't show them to the builder, person or AI, until the app is finished. If it passes those too, it understood the rule; if it only passes the ones it saw, it learned the answers.
An example
Take an expense report app with the rule "above a certain amount, the manager must approve". The cases to write: an expense below the threshold, one exactly at the threshold, one above, and one above made by the manager themselves. The last one is the case most easily forgotten: who approves the approver's expense?
The four tests you can't skip
| Test | What you do | What you find out |
|---|---|---|
| The normal path | You use the app the way a colleague will on a typical day | Whether it does what's needed |
| Another person's data | You log in as a different user and try to see or change the first user's data | Whether the permissions hold |
| Bad input | You leave fields empty, type letters where numbers go, upload odd files | Whether the app defends itself or breaks |
| After every change | You repeat the earlier cases whenever you change something | Whether the change broke something else |
The second test is the most important one for a business app. An app that shows everyone's expense reports to everyone works perfectly well, until someone notices. Permissions are also at the heart of the risks of AI agents: software that can do more than it should is a problem, even if nobody uses it with bad intentions.
Who decides the app is ready
Passing the tests means the app does what the tests check. It doesn't mean it's ready for everyone. That's a decision, and a person makes it.
A good rule, taken from how the most careful IT departments work:
- the person asking for the app writes or confirms the test cases;
- the check is done by something separate from the builder;
- a person who can publish looks at the outcome and decides;
- for apps that touch sensitive data, the approver also checks who will be able to see that data.
If you're wondering how to organize these rules across the whole company, start from how roles are split between who builds and who stays in control.
Testing goes on after release
An app changes: a field gets added, a rule gets modified. Every change is a chance to break something that worked. Keep the test cases in a document and repeat them after every significant change. If you can, make them run by themselves. And make sure you can go back to the previous version if something goes wrong.
The test cases are also worth more than the app itself. They describe how your process really works, with its exceptions. Keep them: if one day the app has to be rebuilt, they'll be the starting point.
The step to take tomorrow
Take the process you're thinking of turning into an app and write five test cases: three normal ones, one odd one that really happened to you, one where a user tries to see another user's data. Next to each one, write what should happen. Keep them to yourself until the app is ready: they'll be your first test. If the app doesn't exist yet, start with the guide on how to build business apps with AI.
Frequently asked questions
How do I test AI-generated code if I can't program?
You write test cases in plain words: a situation and the expected result. Then you test the app with real cases, with another user's data and with bad input. You don't need to read the code: you need to check that the behavior is right.
Are the tests written by the AI that wrote the code enough?
No, because they check the same assumptions as the code: if a rule was misunderstood, it's wrong in both. You need cases chosen by a person who knows the work and a check by something separate. Keeping some cases hidden from the builder helps reveal whether it really understood.
Who should approve an app written by AI before it's used?
A person who can publish, after seeing the test results. For apps that touch sensitive data, they should also check who will be able to see that data. Passing the tests says it works, not that it's ready: that is a decision.

