Dev.to
7/14/2026

My AI-Generated Tests Kept Passing for the Wrong Reason
Short summary
An engineer shares how AI-generated Playwright tests passed for the wrong reasons—checking UI success messages without verifying backend behavior like email delivery or token expiration. A password reset test caught a real security bug (reusable tokens) only after assertions were rewritten to check actual outcomes. AI is useful for boilerplate and locators, but humans must define which outcomes the business actually depends on.
- •AI-generated tests can pass by checking UI success messages without verifying backend behavior
- •Rewriting assertions for a password reset flow caught a token-reuse security bug
- •AI excels at test boilerplate but cannot determine which outcomes matter to the business
Generated with AI, which can make mistakes.
Is this a good recommendation for you?



