AI Built Right — Issue No. 5
AI Built Right: Testing
Why Every Layer of Testing Still Matters When AI Is Writing Your Code
AI-generated code ships faster than ever. Management has noticed. In more than a few organizations, that speed is being used to justify eliminating the one thing that keeps fast code from becoming expensive code: testing.
Published: March 2026 | Series: AI Built Right | Reading time: ~12 min | Platform: AWS Bedrock
I’ve been watching a troubling thread repeat itself on Reddit over the past several months. Developers posting from anonymous accounts, venting about the same situation: management has seen the productivity pitch for AI coding tools, they’ve decided it means testing is now optional, and the QA team either got reassigned or let go. The code ships. Production breaks. And somehow, nobody connects the dots back to the decision to skip testing.
I’ve been building production AI solutions on AWS Bedrock for a year now. AI coding assistance is genuinely transformative — I wouldn’t trade it. But “transformative” and “self-verifying” are not the same thing, and conflating them is how you end up explaining an outage to your board.
This article walks through each level of the testing stack: what it catches, why AI-generated code makes it more necessary rather than less, and why low-code platforms leave a dangerous gap right where you need coverage most.
The Low-Code Problem: No Testing, No Environment
Let’s start with the platforms. If you’re building AI workflows in Replit, Make, or Zapier, you’re working in environments that were not designed around software development discipline. That’s not an insult — they were designed for speed and accessibility, and they deliver on that. But speed and accessibility come with structural trade-offs that matter the moment your solution is handling real data, real users, or real money.
Zapier has no native staging environment at the standard tier levels. Their own community forums have threads dating back years from developers asking how to manage separate development and production environments — the answer is typically “duplicate your Zaps manually and point them at different credentials.” That’s not a testing strategy. That’s a workaround.
Make is more capable and its visual canvas gives you better visibility into workflow logic. But as even Zapier’s own comparison content acknowledges, Make lacks built-in sandbox testing and real-time alerting. Their error handling tools — routers, iterators — are genuinely useful for building, but they don’t substitute for the ability to run your automation against a fully isolated test environment before it touches production data.
Replit is worth examining separately because their Agent 3 product actually does incorporate some automated testing during the build process. Their engineering team wrote openly about the challenge: traditional unit and API testing covers narrow functional slices but misses the client-server boundary where, as they put it, “the mess of problems lurk.” To their credit, Replit has invested in browser automation to address this. But that automated self-testing happens within Replit’s own build loop — it is not a substitute for your organization running acceptance testing against defined requirements, edge cases, and real user workflows. The agent is testing whether it built something that runs. You still need to test whether it built the right thing.
⚠ The Structural Gap
None of these platforms give you code scanning, pre-commit hooks, version-controlled test suites, or a formal staging environment that mirrors production. They give you a place to build and a button to deploy. Everything in between is your responsibility — and most teams using low-code tools don’t realize that responsibility exists until something fails in production.
What AI-Generated Code Actually Does
Before I walk through the testing layers, I want to be specific about the failure modes I’ve encountered building production AI solutions. Not theoretical risks — things I’ve hit repeatedly, across different projects, with different models.
The Hard-Coded Fallback Problem
AI coding assistants have a strong habit of inserting default fallback values when an interface call fails. This is well-intentioned behavior — the AI is trying to make the code resilient. The problem is that it does this quietly, without flagging it, and often with values that look plausible. An API call to a pricing service fails; the AI has already provided a fallback price. A configuration fetch returns null; the AI has substituted a default timeout. The application keeps running. Everything appears to work. Your monitoring shows no errors. Your unit tests pass because the happy path is fine.
You only discover the problem when a customer reports that they were charged the wrong amount, or when you notice a pattern in your logs that doesn’t make sense. By then, the fallback has been silently firing in production for days or weeks. This behavior is so frequent that before I push code, I ask the AI show me where it has hard-coded fallback values.
Interface and Handoff Failures in Step Functions
AWS Step Functions are one of the most effective patterns for orchestrating AI workflows. They’re also one of the most common places I see AI-generated code fail quietly. When I ask an AI to build a multi-step function, it will write each Lambda correctly in isolation. But the interface between steps — the exact shape of the input and output, the handling of partial responses, the error state propagation — is where things go wrong.
Combine this with the fallback problem above and you have a genuinely dangerous situation: Step B receives malformed output from Step A, substitutes a default value, and continues executing. The workflow completes successfully. The result is wrong. Nothing in your logs tells you why.
External APIs are even worse. If you don’t pull the API’s documentation and include it in your coding prompt, the AI coding tool will simply make up variables and supported values. Again, it will usually provide bogus default fallback values when the API call fails.
Error Handling Is Always Incomplete on the First Pass
I’ve made it a practice at the end of every build to ask the AI directly: “Are we handling all expected errors gracefully?” Without exception, the answer involves changes. Sometimes it’s a missing catch block on an external service call. Sometimes it’s an unhandled edge case in parsing. Sometimes it’s a retry that doesn’t account for idempotency. The AI knows what good error handling looks like — it just doesn’t always apply it unprompted.
Pre-Commit Hooks Always Find Something
I run pre-commit hooks on every project: linting, secret scanning, dependency auditing, basic static analysis. I have never — not once — pushed AI-generated code through a pre-commit hook and gotten a clean pass on the first try. Usually it’s minor: formatting violations, an unused import, a dependency with a known vulnerability. Occasionally it’s more significant. The point is that these tools catch real issues, consistently, in code that an AI produced and that I reviewed. Without them, some of those issues ship.
⚠ Industry Case Study
Air Canada and the Liability of Untested AI Output
In February 2024, British Columbia’s Civil Resolution Tribunal ruled against Air Canada after a customer was given incorrect information by the airline’s AI chatbot regarding bereavement fares. Air Canada’s defense was remarkable: they argued the chatbot was “a separate legal entity” responsible for its own actions. The tribunal rejected this outright. The airline was held liable for negligent misrepresentation by its own AI system.
The chatbot’s response directly contradicted Air Canada’s own published policy — a discrepancy that functional acceptance testing would have caught. Proper UAT against defined business rules, with test cases covering bereavement fare scenarios, would have flagged the hallucination before it ever reached a grieving customer. The lesson isn’t that AI chatbots are dangerous. It’s that deploying AI-generated responses without testing them against your actual policies and business logic is a liability you own entirely.
The Testing Stack, Layer by Layer
Good testing isn’t a single activity that happens at the end of a build. It’s a layered discipline where each level catches a different category of problem. With AI-generated code, the case for all five layers is stronger than it’s ever been.
Layer 1: Static Code Analysis and Security Scanning
Static analysis runs before anything executes. Tools like Bandit (Python), ESLint, Semgrep, and Checkov analyze your code for known vulnerability patterns, security misconfigurations, and policy violations without running the code itself. Pre-commit hooks — using a framework like pre-commit.ci or running checks directly in your CI pipeline — enforce that these scans run on every commit before it reaches your repository.
For AI-generated code specifically, security scanning deserves extra attention. AI models sometimes invent non-existent packages or reference internal functions that don’t exist — a problem called hallucinated dependencies. If a developer installs a package suggested by an AI without auditing it first, they may be installing something that doesn’t exist yet, which creates an opening for a typosquatting attack when someone registers that package name with malicious code. A dependency audit on every AI-suggested package, run as part of your pre-commit and CI process, is not optional.
OWASP maintains a regularly updated list of the top security vulnerabilities in web applications. A 2024 Stanford study found that AI-assisted developers were more likely to introduce security vulnerabilities than those coding manually, with common issues including SQL injections and weak input validation. These are exactly the categories that static analysis tools are designed to catch. Run them.
Standard tooling for this layer includes:
- Bandit — Python security linting
- Semgrep — customizable static analysis for multiple languages
- Checkov — infrastructure-as-code security scanning (critical for Terraform and CDK on AWS)
- Trivy or Grype — container and dependency vulnerability scanning
- detect-secrets — catches credentials and API keys before they reach your repository
# .pre-commit-config.yaml — minimal example for a Python/AWS project
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.5.0
hooks:
- id: trailing-whitespace
- id: end-of-file-fixer
- id: check-yaml
- id: check-added-large-files
- repo: https://github.com/PyCQA/bandit
rev: 1.7.7
hooks:
- id: bandit
args: ["-c", "pyproject.toml"]
- repo: https://github.com/Yelp/detect-secrets
rev: v1.4.0
hooks:
- id: detect-secrets
- repo: https://github.com/bridgecrewio/checkov
rev: 3.2.0
hooks:
- id: checkov
args: ["--directory", "infrastructure/"]
Layer 2: Unit Testing
Unit tests verify that individual functions and methods return the expected output for a given input. They are fast, isolated, and they run in your CI pipeline on every push. For AI-generated code, they serve a specific and critical function: catching the fallback problem described earlier.
When a function is supposed to call an external service and return that service’s response, your unit test should mock the service call and verify that the function handles both the success case and the failure case correctly — not just that it returns something. If the function silently substitutes a default value when the service call fails, a properly designed unit test will catch it.
“The AI was often testing its own assumptions, not my intent. The generated tests were beautiful boilerplate, but they rarely included the complex edge cases, domain-specific constraints, or legacy system interactions that actually matter.” — Senior engineer on AI-generated test suites, 2025
I admit I rely on the AI to write most of my unit tests, as I find this work extremely boring. This is a poor practice, though I do make sure it covers the specified acceptance criteria. Of course, asking the AI to write your unit tests creates a circular problem. The AI writes the code, then writes tests that verify what the code does — not necessarily what the code should do. Your tests need to be grounded in your requirements, your data contracts, and your business rules. AI can help write the boilerplate. A human needs to define the assertions.
Layer 3: Integration and System Testing
Integration tests verify that components work together correctly. System tests verify that end-to-end workflows produce the expected outcomes. These are the tests that catch the Step Function interface failures I described earlier — the cases where every Lambda is correct in isolation but the handoffs between them are broken.
On AWS, this means running integration tests against a dedicated testing account or environment, using real (but sandboxed) versions of your services. Not mocks — the mocks can’t catch infrastructure misconfigurations, IAM permission gaps, or the subtle behavioral differences between a mocked DynamoDB and the real one at scale.
Analysis of nearly 500 open-source GitHub pull requests found that AI-generated code creates 1.7 times more issues than human-written code. System tests are where many of those issues surface for the first time. The code runs. The logic is wrong. Only a test that exercises the full workflow against realistic data will find it.
Layer 4: Internal Acceptance Testing
Internal acceptance testing (IAT) — sometimes called alpha testing, developer acceptance testing or pre-UAT — is the phase where the person who wrote the requirements (product owner, business analyst) validates the solution against your documented requirements before it goes to end users. This is different from system testing: system tests verify technical correctness; IAT verifies that the system does what you actually asked it to do.
This distinction matters enormously for AI projects, because AI solutions are often built iteratively — requirements evolve during the build. By the end of a multi-week project, there are frequently requirements that were added mid-stream and documented in a ticket somewhere but never explicitly verified end-to-end. IAT is where those gaps show up.
My IAT process for every production AI project includes two things: detailed and evidenced testing of the acceptance criteria on every user story, a structured walkthrough of each major workflow with someone who wasn’t involved in the build to identify required tests based on the architecture. Both of these steps find defects or improvements 90% of the time.
Layer 5: User Acceptance Testing
User acceptance testing is where the real world shows up. Your users know things about your domain, your edge cases, and your data that didn’t make it into the requirements document. They will find scenarios that nobody on the build team thought to test. They will use the interface in ways that don’t match your assumptions. And when they do, you want to discover those scenarios in a controlled testing environment, not in production.
For AI-specific solutions, UAT has an additional dimension: users need to validate not just that the system works, but that the AI’s outputs are accurate, appropriate and consistent. If you’ve built a document summarization tool, your users are the ones who can tell you whether the summaries are correct and useful. If you’ve built an AI workflow that makes decisions, your users are the ones who can identify the cases where the decision logic is wrong. No automated test can substitute for domain expertise evaluating AI outputs.
The Air Canada case is an instructive example of what UAT would have caught. A basic UAT script for a customer-facing chatbot covering the bereavement fare scenario — “does the chatbot give correct information about bereavement fare eligibility and process?” — would have exposed the hallucination before it ever reached a real customer. Instead, a grieving customer got wrong information, and Air Canada spent time in a tribunal arguing that their own chatbot was a separate legal entity. The ruling serves as a reminder of the legal and ethical obligations businesses have towards consumers, requiring rigorous testing and oversight of AI systems to prevent misinformation.
What the Industry Data Says
If you’re making the case internally for maintaining your testing practices in the face of “the AI will handle it” pressure, here’s what the data looks like right now.
“AI coding tools dramatically increase output, but they also introduce predictable, measurable weaknesses that organizations must actively mitigate,” according to CodeRabbit’s director of AI, reflecting on their 2025 analysis. That analysis found AI-generated code creates significantly more issues than human-written code — not in spite of higher output volume, but correlated with it. More code, faster, with less review depth per line.
Developer trust in AI accuracy dropped from 69% in 2024 to 54% in 2025. Only 16% of QA teams have actually adopted AI for testing, despite 75% calling it a strategic priority. The people who use AI tools every day are becoming more skeptical, not less. That skepticism is earned. The more production experience developers have with AI-generated code, the more clearly they understand what testing is still catching.
RAND Corporation research found that more than 80% of AI projects fail to reach meaningful production deployment — exactly twice the failure rate of IT projects without AI components. There are multiple causes for this, but insufficient testing infrastructure is consistently cited among them. The complexity of AI systems — the non-determinism, the dependency on external models, the difficulty of reproducing failures — makes testing harder, not easier. Treating it as optional is how you end up in that 80%.
Building the Testing Culture Back In
If you’re the person trying to push back on “AI writes the code so we don’t need testing” in your organization, the framing matters. The argument isn’t “AI is bad” — it’s “AI changes the risk profile in ways that make testing more important, not less.”
AI-generated code is faster to produce and harder to audit. It has consistent failure modes — the hard-coded fallbacks, the interface gaps, the incomplete error handling — that are predictable and therefore catchable. A well-designed test suite catches those failure modes reliably. The cost of that test suite is fixed. The cost of a production failure is not.
For teams moving from low-code tools to production AI development, the testing infrastructure is part of what you’re building. Pre-commit hooks, a CI/CD pipeline with automated test runs, a staging environment, a formal UAT process — these aren’t overhead. They’re the engineering foundation that makes it safe to move fast. Without them, “moving fast” just means “failing faster.”
⚠ A Note on AI-Generated Tests
AI can absolutely help you write tests — I use it for scaffolding test files, generating mock data, and writing boilerplate assertion code. But the AI cannot define your test cases. Test cases come from your requirements, your business logic, and your knowledge of edge cases in your domain. If you let the AI define both the code and the tests, you get a system that is internally consistent but not necessarily correct. Treat AI test generation the same way you treat AI code generation: useful starting point, requires human review and augmentation.
The Quick Reference: Testing Responsibilities by Layer
| Layer | What It Catches | Low-Code Support | Critical for AI Code? |
|---|---|---|---|
| Static Analysis / Code Scanning | Vulnerabilities, secrets, dependency risks, formatting | No | Yes |
| Unit Testing | Fallback values, incorrect output, edge case handling | No | Yes |
| Integration / System Testing | Interface failures, step function handoffs, data contract violations | No | Yes |
| Internal Acceptance Testing | Missing requirements, error path gaps, requirement drift | Partial | Yes |
| User Acceptance Testing | Domain accuracy, AI output quality, real-world edge cases | Partial | Yes |
Note on “Partial” for IAT/UAT in low-code tools: these testing phases can technically be performed against any deployed system, including low-code tools. The “Partial” rating reflects that low-code platforms lack the infrastructure to formalize, automate, or version-control these processes. Manual walkthroughs are possible; a repeatable, traceable testing process is not.
Bottom Line
AI coding assistance is one of the most useful things to happen to software development in a long time. I use it on every project. I will continue to use it. I am also deeply skeptical of it in the specific, targeted ways that nearly two years of production experience have taught me to be — and I test accordingly.
The argument that AI-generated code doesn’t need testing isn’t a bold bet on new technology. It’s a familiar story with a predictable ending: a defect that testing would have caught reaches production, costs ten times what testing would have cost to fix, and leaves an organization explaining to someone why their AI did something it shouldn’t have done.
The testing stack isn’t slowing you down. It’s what makes it safe to go fast.
About This Series
AI Built Right is a series for technical founders, product leaders, and CTOs navigating the decision between low-code AI tools and production-grade AI development.
The author works as an AI Program Manager and Fractional CTO for AI startups, specializing in production-grade AI on AWS.
