Testing AI-generated code when you are not a developer
Read in : Français

Contents
- Why does AI-generated code need testing?
- Six levels of testing you can do without coding
- Step 1: write your scenarios before you click
- Step 2: the "evil" tests
- Bad input
- The two-account test
- Step 3: open the console and the Network tab
- Step 4: run the built-in security scanners
- Step 5: run each page through Lighthouse
- Step 6: have the AI write automated tests
- When should you bring in a professional?
- Frequently asked questions
- Frequently asked questions
- Sources
Testing AI-generated code when you are not a developer means checking what the app does, not how it is written. You play the normal user, then the clumsy user, then the malicious one. With a checklist, two test accounts, the browser console and the scanners built into your tools, you catch most problems before your users do.
Why does AI-generated code need testing?
Because code that works is not the same as code that is safe. Veracode's 2025 GenAI Code Security Report, published on 30 July 2025, ran more than 100 AI models through 80 coding tasks: the generated code contained a security flaw in 45% of cases. On cross-site scripting (XSS) protection, the models failed in 86% of relevant cases.
while AI produces functional code, it introduces security vulnerabilities in 45 percent of cases
— Veracode, press release, 30 July 2025
Veracode sells code-scanning tools, so keep that in mind. But the finding lines up with the OWASP Top 10 2025, where Broken Access Control sits at number one: a user seeing someone else's data is the most common flaw. It is also the one you can test without reading a single line of code.
The other reason is more mundane: the AI sometimes changes things you did not ask for. A fix on the checkout page can break sign-up. Without tests, a customer tells you.
Six levels of testing you can do without coding
Here are six levels, from the simplest to the most tooled-up. The first three are non-negotiable before going live.
| Level | What you check | Tool | Time |
|---|---|---|---|
| 1. Written scenarios | The main journeys work | A table, your browser | 30 min |
| 2. "Evil" tests | The app survives mistakes and abuse | Two test accounts | 30 min |
| 3. Console and network | No hidden errors, no leaking data | Browser developer tools | 15 min |
| 4. Security scanners | Known misconfigurations | Lovable scan, Supabase Security Advisor | 5 to 15 min |
| 5. Lighthouse audit | Performance, accessibility, SEO | Chrome DevTools | 1 min per page |
| 6. Automated tests | Nothing breaks on the next change | Playwright, written by the AI | 1 hour the first time |
Step 1: write your scenarios before you click
A test scenario is a sentence of the form "when I do X, I should see Y". Write it before you test, otherwise you end up testing what the app does instead of what it should do. If you wrote a spec before your first prompt, your scenarios come straight out of it.
Example for an appointment booking app:
| Scenario | Expected result | Pass? |
|---|---|---|
| I sign up with a valid email | I receive the confirmation email | |
| I book a free slot | The slot shows up in "My bookings" | |
| I cancel that booking | The slot is free again for others | |
| I log out and open "My bookings" | I am sent to the login page | |
| I do all of this on my phone | Nothing is cut off or unreadable |
Run every scenario in a private browsing window, so an existing session does not hide a problem.
Step 2: the "evil" tests
Evil tests check what should fail. This is where vibe-coded apps are weakest, because the AI builds the happy path and forgets the rest.
Bad input
- Submit every form empty.
- Paste 5,000 characters into a "first name" field.
- Enter a date in the past, a negative price, a quantity of 0.
- Double-click "Pay" or "Submit" very fast.
- Paste
<script>alert(1)</script>into a text field, then open the page where that text is displayed. If an alert box pops up, your app is vulnerable to XSS.
The two-account test
This is the most important test in this article. Create two accounts, A and B, in two different browsers.
- As A, create something (a booking, a note, an invoice).
- Copy the URL of the page that shows it, for example
/invoices/42. - Paste that URL into B's browser.
- If B can see A's invoice, you have an access-control hole.
Also try changing the number in the URL (/invoices/41, /invoices/43). On a Supabase app, the usual cause is a table without RLS: the article on the Supabase RLS mistake shows how to fix it.
Step 3: open the console and the Network tab
Your browser's developer tools show what the app hides behind an interface that looks fine. In Chrome, open them with Ctrl+Shift+J (Windows, Linux) or Cmd+Option+J (Mac).
- Console tab: rerun your scenarios with the console open. Every red message is an error. Copy it exactly and give it to the AI: that is the best debugging prompt there is.
- Network tab: reload the page, click on the requests, then on the Response or Preview tab. Check that the response only contains the logged-in user's data, not your entire customer list.
- Search the loaded files: look for
sk_,secretorservice_role. A secret key visible in the browser must be revoked straight away, as explained in why API keys must never live in your front end.
Step 4: run the built-in security scanners
Vibe coding platforms have added scanners that catch known configuration mistakes. They are free, so run them every time you publish.
- Lovable: the Quick scan runs automatically on every publish and checks your code and live database configuration. The Deep scan reviews the whole app, usually takes 3 to 13 minutes and uses no credits. Find it under More, then Security. Both are free in Lovable.
- Supabase: the Security Advisor in the dashboard flags, among other things, public tables without RLS, exposed sensitive columns and over-permissive policies such as
USING (true).
Lovable's documentation is upfront about the limit: "No issues found" does not mean the app is risk-free, because the scanner cannot catch every possible risk. For apps handling sensitive data, it recommends an additional professional security review.
Step 5: run each page through Lighthouse
Lighthouse is the audit tool built into Chrome: it scores a page on performance, accessibility, SEO and best practices. Open developer tools, click the Lighthouse tab, then Analyze page load. The report takes 30 to 60 seconds.
Do not chase a perfect 100. Look for the red warnings: heavy images, buttons without labels, poor contrast. Copy the report and ask the AI to fix the three worst issues.
Step 6: have the AI write automated tests
An automated test replays your scenarios for you, in seconds, after every change. It is the only way to be sure a fix did not break something elsewhere.
You do not have to write these tests. Playwright, an open-source browser testing tool, has a recorder: npx playwright codegen followed by your app's URL opens a browser, you click around like a user, and Playwright writes the test code in a second window. If you work with a coding agent such as Claude Code or Cursor, just ask it:
Install Playwright in this project and write end-to-end tests
for these scenarios: [paste your table from step 1].
Add a test that checks user B cannot open the page of a resource
created by user A.
Run the tests, show me the results, and do not change the application
code to make a test pass without asking me first.
That last sentence matters: a hurried agent may "fix" a test by weakening the test instead of fixing the bug. Before you let the agent loose, commit your work: with Git, you can go back to the version that worked in one command.
When should you bring in a professional?
Get your app reviewed by a developer or security auditor as soon as it touches any of these:
- payments stored or handled outside Stripe;
- health data, children's data, identity documents;
- more than a few hundred active users;
- an app you sell to a client who will be responsible for it.
Half a day of review costs less than a data breach. The pre-launch security checklist tells you what to have checked first.
Frequently asked questions
Frequently asked questions
Can you really test an app without reading the code?
Yes, for the most part. You test behaviour: user journeys, bad input, data isolation between two accounts, error messages in the console. These tests catch the most common flaws, such as broken access control, number one in the OWASP Top 10 2025. For complex business logic or sensitive data, a professional review is still needed.
Are the Lovable and Supabase scanners enough?
No. They catch known configuration mistakes, such as a table without RLS or an overly open policy, and they are free. But Lovable's own documentation says a clean scan does not guarantee there is no risk. Scanners do not understand your business rules: only the two-account test checks that one customer cannot see another's data.
What is the two-account test?
You create two accounts, A and B, in two browsers. As A, you create something and copy the URL of the page showing it. You open that URL as B. If B sees A's data, your app has an access-control hole. Also try changing the ID in the URL. It is the highest-value test you can run before launch.
Can the AI write the tests for me?
Yes. A coding agent can install Playwright and write end-to-end tests from scenarios written in plain English. You can also use npx playwright codegen, which records your clicks and generates the test. Tell the agent explicitly not to change the app's code to make a test pass, and check that it actually runs the tests.
How often should I test?
Run the main scenarios and evil tests before every significant release, the scanners on every publish, and the automated tests after every change once you have them. Also test after every "small fix" you ask the AI for: that is often when it edits a file you did not expect.
Sources
- AI-Generated Code Poses Major Security Risks in Nearly Half of All Development Tasks — Veracode
- OWASP Top 10:2025 — OWASP
- Security view — Lovable Documentation
- Performance and security advisors — Supabase Docs
- Inspect network activity — Chrome DevTools
- Console overview — Chrome DevTools
- Introduction to Lighthouse — Chrome for Developers
- Test generator (codegen) — Playwright

