Menu
Martin Fowler·November 11, 2026

Ensuring AI-Generated Code Quality through Data-Driven Testing

This article discusses a new paradigm for automated testing in the age of AI-generated code. It proposes that developers become 'customers' of the AI, making customer tests (expressed as data) the primary contract. This approach leverages AI itself to create and maintain DSL parsers and custom test runners, ensuring human-readable tests protect against functional errors.

Read original on Martin Fowler

The advent of AI coding assistants introduces significant challenges to traditional software development practices, particularly in quality assurance. When AI generates both production code and its corresponding tests, the reliability of those tests as a safeguard against functional errors can be compromised. This article proposes a shift in perspective, positioning developers as customers of the AI, and advocating for a 'tests as data' approach to ensure code quality.

Developer as Customer, Tests as Contract

A core premise is that when AI is the primary code generator, the human developer's role shifts from primary author to primary consumer or customer. Consequently, the relationship between human and AI needs a clear contract. This contract is best established through customer-centric tests, focusing on desired behavior from an external perspective rather than internal implementation details.

The "Tests as Data" Paradigm

The article suggests moving this critical contract into test data, rather than embedding it deeply within test code. This separation makes tests more resilient to arbitrary modifications by coding agents and easier for humans to read and verify. Historically, creating robust Domain-Specific Language (DSL) parsers and custom test runners for data-driven testing was expensive, but AI's capabilities now make this a more viable and efficient architectural choice.

💡

Architectural Implications

Adopting 'tests as data' requires designing systems with clear interfaces where behavioral expectations can be defined externally. This might involve building dedicated testing frameworks or integrating AI-powered DSL generators that translate human-readable specifications into executable test cases, ensuring maintainability and reducing the AI's ability to silently alter test logic.

This architectural approach shifts the testing burden from manually written code to structured data that describes expected outcomes. The system design for such an environment would involve components for test data management, AI-driven test execution, and result validation, ensuring that the human intent remains the ultimate source of truth for functionality.

AI developmentautomated testingsoftware qualityAI code generationtest automationsystem qualitydeveloper experience

Comments

Loading comments...