Automated structural testing of LLM-based agents: methods, framework, and case studies

Fuente: arXiv
Gespeichert in:
Bibliographische Detailangaben
Hauptverfasser: Kohl, Jens, Kruse, Otto, Mostafa, Youssef, Luckow, Andre, Schroer, Karsten, Riedl, Thomas, French, Ryan, Katz, David, Luitz, Manuel P., Takher, Tanrajbir, Friedl, Ken E., Laurent-Winter, Céline
Format: Preprint
Veröffentlicht: 2026
Schlagworte:
Online-Zugang:
Tags: Tag hinzufügen
Keine Tags, Fügen Sie den ersten Tag hinzu!
_version_ 1866911401451192320
author Kohl, Jens
Kruse, Otto
Mostafa, Youssef
Luckow, Andre
Schroer, Karsten
Riedl, Thomas
French, Ryan
Katz, David
Luitz, Manuel P.
Takher, Tanrajbir
Friedl, Ken E.
Laurent-Winter, Céline
author_facet Kohl, Jens
Kruse, Otto
Mostafa, Youssef
Luckow, Andre
Schroer, Karsten
Riedl, Thomas
French, Ryan
Katz, David
Luitz, Manuel P.
Takher, Tanrajbir
Friedl, Ken E.
Laurent-Winter, Céline
contents LLM-based agents are rapidly being adopted across diverse domains. Since they interact with users without supervision, they must be tested extensively. Current testing approaches focus on acceptance-level evaluation from the user's perspective. While intuitive, these tests require manual evaluation, are difficult to automate, do not facilitate root cause analysis, and incur expensive test environments. In this paper, we present methods to enable structural testing of LLM-based agents. Our approach utilizes traces (based on OpenTelemetry) to capture agent trajectories, employs mocking to enforce reproducible LLM behavior, and adds assertions to automate test verification. This enables testing agent components and interactions at a deeper technical level within automated workflows. We demonstrate how structural testing enables the adaptation of software engineering best practices to agents, including the test automation pyramid, regression testing, test-driven development, and multi-language testing. In representative case studies, we demonstrate automated execution and faster root-cause analysis. Collectively, these methods reduce testing costs and improve agent quality through higher coverage, reusability, and earlier defect detection. We provide an open source reference implementation on GitHub.
format Preprint
id arxiv_https___arxiv_org_abs_2601_18827
institution arXiv
publishDate 2026
record_format arxiv
spellingShingle Automated structural testing of LLM-based agents: methods, framework, and case studies
Kohl, Jens
Kruse, Otto
Mostafa, Youssef
Luckow, Andre
Schroer, Karsten
Riedl, Thomas
French, Ryan
Katz, David
Luitz, Manuel P.
Takher, Tanrajbir
Friedl, Ken E.
Laurent-Winter, Céline
Software Engineering
Artificial Intelligence
I.2.7; I.2.11; D.2.4; D.2.5
LLM-based agents are rapidly being adopted across diverse domains. Since they interact with users without supervision, they must be tested extensively. Current testing approaches focus on acceptance-level evaluation from the user's perspective. While intuitive, these tests require manual evaluation, are difficult to automate, do not facilitate root cause analysis, and incur expensive test environments. In this paper, we present methods to enable structural testing of LLM-based agents. Our approach utilizes traces (based on OpenTelemetry) to capture agent trajectories, employs mocking to enforce reproducible LLM behavior, and adds assertions to automate test verification. This enables testing agent components and interactions at a deeper technical level within automated workflows. We demonstrate how structural testing enables the adaptation of software engineering best practices to agents, including the test automation pyramid, regression testing, test-driven development, and multi-language testing. In representative case studies, we demonstrate automated execution and faster root-cause analysis. Collectively, these methods reduce testing costs and improve agent quality through higher coverage, reusability, and earlier defect detection. We provide an open source reference implementation on GitHub.
title Automated structural testing of LLM-based agents: methods, framework, and case studies
topic Software Engineering
Artificial Intelligence
I.2.7; I.2.11; D.2.4; D.2.5
url https://arxiv.org/abs/2601.18827