Test Driven Development In The AI Era
Large language models accelerate software development, but the code and tests they generate often lack the discipline test-driven development (TDD) is meant to enforce. This paper proposes AI-TDD, a methodology that operationalizes the Red-Green-Refactor cycle through three role-based prompt personas — an Architect, a Test Writer, and an Implementer — and evaluates it as a comparative case study against Code-First, a conventional AI-assisted development baseline, on a custom-built e-commerce pricing engine with documented state interdependence across ten cross-mechanism business rules. Considered in isolation, the primary metrics do not show an unconditional advantage for AI-TDD: Code-First produced lower cyclomatic complexity and higher Mutation Score and test coverage. AI-TDD, in turn, sustained a 100% Fail-to-Pass rate across every genuinely attempted cycle, correctly generalized business rules ahead of schedule, and produced code its own validator found easier to follow one criterion at a time. The observed quality gap traces to two specific, addressable mechanisms — architectural conformance and under-tested generalized behavior — rather than an inherent limitation of AI-driven test-first discipline. This work formalizes the AI-TDD methodology as reusable personas, contributes an empirical evaluation collecting Mutation Score on a high-complexity business-rule system, and characterizes the mechanisms behind a comparative quality gap rather than offering a simple verdict on which approach is better
2026/1 - POC2
Orientador: Marco Túlio Valente
Palavras-chave: Test-Driven Development, Large Language Models, AI-Assisted Software Development, Mutation Testing, Case Study
PDF Disponível