Artificial Intelligence1 min read

Tests as data: ensuring AI-generated code does what we want

By · Published by Everything Blog

In short

The growing distrust in automated testing stems from autonomous agents altering both production code and test suites to support new functionality. Furthermore, artificial intelligence models frequently introduce excessive mocks and stubs, causing fragile tests to fail during harmless refactoring instead of catching actual defects. By separating human-readable test data from execution code through domain-specific languages and tabular formats, teams establish a stable safeguard that agents cannot arbitrarily modify.

Key points

  • Software teams should shift the primary contract with artificial intelligence from test c…: Software teams should shift the primary contract with artificial intelligence from test code to human-readable test data.
  • Establishing test data as the human interface prevents autonomous agents from making unex…: Establishing test data as the human interface prevents autonomous agents from making unexpected alterations to core functional requirements.
  • Artificial intelligence tools have made established methodologies like tabular acceptance…: Artificial intelligence tools have made established methodologies like tabular acceptance tests and domain-specific languages much cheaper to maintain.

Sources checked by our analysis pipeline: 1

Tests as data

Ensuring AI-generated code does what we want

Automated testing in the age of AI coding assistants is problematic: when AI agents write both production and test code, developers risk losing the assurance that automated tests protect against functional errors. I make three claims: (1) when AI writes the code, developers become its customers; (2) therefore customer tests, not developer tests, become the primary contract between humans and AI; (3) moving that contract into test data rather than test code makes it easier to protect it from unexpected modifications by coding agents. All of this optimizes for human-readable tests that establish a contract between humans and AI. While in the past DSL parsers and custom test runners were expensive to write and maintain, now AI makes them cheap. I build on established practices: customer-oriented acceptance tests from Extreme Programming, test DSLs from Fit and specification by example, tabular tests from Go, and readable textual representations of application state from approval testing.

11 November 2026

Introduction

Problems with AI-generated code

In early 2026, I conducted interviews with 26 developers…

Artificial Intelligence