Editor’s introduction
The study focuses on TestMap, a prototype infrastructure designed to validate foundation-model-assisted test generation in C#/.NET repositories. It tracks the full lifecycle of generated test candidates—passing, failed, repaired, or low-impact—by mapping execution artifacts back to source code elements such as methods, lines, and branches. Coverage, mutation results, and test smells are attributed to specific code locations, enabling context-based test selection and evaluation. This approach allows researchers to observe model limitations, toolchain inefficiencies, or system faults through intermediate outcomes. The evidence model ensures generated tests are observable, repeatable, and comparable across different models, prompts, and generation strategies. The study emphasizes that AI-generated tests remain code artifacts requiring validation before they can be trusted to reflect system reliability.
Introduction
Foundation models (FMs) are increasingly used to produce software artifacts such as code, tests, and documentation. Stack Overflow’s 2025 Developer Survey reports that “84% of respondents are using or planning to use AI tools in their development process,” with “51% of professional developers” using AI tools daily. The same survey reports AI use across common development tasks, including documentation, testing code, and writing code, while also finding that 45% of respondents distrust AI tool outputs. Google’s 2025 DORA report similarly finds that “90% of technology professionals report using AI at work,” yet 30% report having “little to no trust in the code generated by AI”. JetBrains reports a similar pattern: “85% [of] developers regularly use AI for coding and development,” while quality of generated code remains a leading concern. Together, these reports suggest that AI-assisted software development is becoming standard practice, but also introduces an active validation challenge: FM-generated artifacts are becoming common in development workflows before developers fully trust them. For generated tests, this validation challenge creates a practical infrastructure problem: researchers and developers need repeatable ways to collect evidence about whether generated tests build, pass, improve testing signals, expose failures, and justify further review.
This validation challenge is especially important for software testing. Tests are not only software artifacts that must compile, execute, and be maintained; they are also evidence artifacts used to support confidence in the behavior of the system under test. When FMs generate tests, especially in workflows where they may also generate implementation code, software teams face a recursive validation problem: generated tests must themselves be validated before they can be trusted to validate the system under test. Previous work shows that generated code can be incorrect and that tests are needed to verify generated code; work also shows that generated tests may fail to capture code implementation bugs.
This validation problem builds on long-standing challenges in software testing. Software testing is essential for improving software quality and reliability, but writing and maintaining tests remains costly. While unit tests help verify the behavior of the system, prior work shows that manual test creation is time-consuming and often avoided by developers. To reduce the manual test-creation burden, automated test generation tools, like EvoSuite and Randoop, have sought to generate tests with minimal human intervention. These tools have proven advantages in terms of increasing code coverage and mutation scores; however, prior work also reports challenges in maintainability, readability, and effectiveness on complex codebases. These results highlight a particular theme within automated test generation: producing tests is only one part of the problem; determining whether the generated tests are useful, maintainable, and worth integrating is equally, if not more, important.
FMs renew this challenge by enabling test generation from a variety of sources, including source code, project artifacts, requirements, issue reports, and natural language prompts. Recent work suggests that LLM-based test generation can perform competitively with traditional approaches, and developer surveys indicate practitioner interest in using AI tools for testing code. However, the validation problem remains; a generated test may compile and pass but this does not prove correctness—the test oracle problem. A generated test may provide additional code coverage without improving fault detection. A generated test may also improve mutation score while suffering from test smells. Recent work suggests that LLMs can generate test oracles that are comparable to programmer-written oracles in some settings. As Alshahwan et al. argue, the growing availability of automated testing tools requires rigorous evaluation to determine whether generated tests are accurate and relevant in practice.
Signals relevant to this evaluation already exist in software engineering practice. For example, build outcomes, execution results, coverage reports, mutation testing results, static code metrics, and test smells can all provide evidence about candidate tests—or test cases automatically generated by FMs to verify program behavior that developers must review and integrate into their codebase. However, these signals are often fragmented across tools and typically reported as aggregate outcomes rather than being connected to the candidate. This fragmentation creates an infrastructure gap: FM-assisted test generation requires systems that can collect, relate, and preserve evidence across the lifecycle of a generated test candidate. Such infrastructure should support candidate-level review, such as whether a generated test appears worth accepting or investigating, and strategy-level analysis, such as which model, prompt, or repair workflow works best for a particular codebase.
Automated Test Generation
Automated test generation is an established research area. Tools such as Randoop and EvoSuite generate unit tests for Java programs using feedback-directed random testing and search-based software testing, respectively. Randoop constructs method-call sequences and uses execution feedback to discard illegal or redundant tests, while EvoSuite uses genetic algorithms to optimize generated suites toward testing objectives such as maximizing coverage. These systems demonstrate that automated techniques can produce executable tests and improve measurable testing signals. However, prior work also shows persistent adoption challenges: generated tests can be difficult for developers to read, understand, and maintain. These limitations motivate a recurring theme: generated tests should not be evaluated only by whether they execute or improve aggregate metrics, but also by whether they are understandable, useful, and suitable for integration into a project.
Evaluating Generated Tests
Evaluating generated tests is difficult because common testing signals capture different and incomplete aspects of test quality. A generated test that compiles and passes is executable in the target project, but passing alone does not imply that the test checks meaningful behavior. This reflects the broader test oracle problem: tests require a mechanism for determining whether the observed behavior of the system under test is correct, and automating this judgment remains a central challenge in software testing.
Coverage is a commonly used signal for evaluating generated tests. While useful, coverage is incomplete because it shows which code was exercised, not whether the exercised behavior was validated by meaningful assertions. Mutation testing provides a stronger signal by measuring whether tests detect injected behavioral changes, but mutation testing is computationally expensive and does not fully establish semantic correctness. Test smells and code metrics provide additional evidence about maintainability and readability. Prior work also shows that production code can be more defect-prone when tested by smelly tests.
Failed generated tests are also evidence. A failing candidate may reflect an invalid oracle, missing context, or a model limitation, but it may also reveal ambiguous behavior, a possible implementation defect, or a weakness in the generation pipeline. Recent work suggests that design choices in FM-assisted test generation tools can cause bug-revealing tests to be discarded or can lead generated tests to validate faulty implementation behavior. These signals are often fragmented across tools, limiting the ability to connect generated tests with the evidence needed to validate them.
Evidence-Based Software Engineering
Evidence is critical for enhancing the reliability of decisions and practices across disciplines. In particular, contextual evidence gathers information from local data sources. Research outlines the need for evidence-based software engineering practices. For instance, Dyba compares software development to the medical domain, motivating the need for enhanced organizational and technical infrastructure to promote evidence-based practices. Prior work finds developers often rely on experiences to guide development practices rather than evidence, and suggests contextual evidence is often unavailable. Further, studies show lack of contexts inhibits LLMs from effectively supporting software development tasks, reducing test case quality. Meanwhile, techniques to improve contextual evidence, such as prompt engineering and project contexts, can enhance the automatically generated test cases. We extend these efforts by introducing evidence infrastructure for FM-assisted test case generation, leveraging contextual evidence to assist developers in assessing the performance of FM-generated test cases.
Overview
At a high level, TestMap ingests a repository, analyzes its source and test projects, records baseline testing evidence, selects generation targets, constructs model prompts, generates candidate tests, validates those candidates through build and execution, collects coverage and mutation evidence, detects code metrics and test smells, and persists candidate histories for analysis. Each generated test is associated with evidence about its target, generation context, execution outcome, testing contribution, quality indicators, repair history, and final status. This evidence allows developers and researchers to inspect not only whether a generated test passes, but also what it covers, whether it improves the existing suite, whether it detects behavioral changes, whether it required repair, and whether it appears maintainable.
TestMap is designed to support both candidate-level and strategy-level decisions. At the candidate level, the collected evidence can help developers decide whether a generated test should be accepted, edited, investigated, or rejected, although the current prototype does not yet study developer decisions directly. At the strategy level, TestMap’s experiment workflow enables repository-specific comparisons of models, prompts, context settings, generation strategies, pass@k budgets, and repair loops. In this way, TestMap complements standardized benchmarks by providing evidence about how foundation-model-assisted test generation behaves in a concrete codebase with its actual build system, dependencies, existing tests, and quality signals.
Evidence Model
TestMap organizes evidence around the lifecycle of a generated test candidate. A candidate test begins as model output, but it is not treated as a test contribution until it has been validated, measured, and associated with evidence about its behavior in the target repository. We use the term evidence-backed to mean that each generated candidate is linked to structured signals about its target, generation context, execution behavior, testing contribution, quality indicators, failure history, repair history, and pipeline outcome. These signals do not prove that a generated test is correct; rather, they make the candidate inspectable and comparable.
The generated test candidate is the central evidence-bearing object in TestMap. Each candidate is linked to a source-code method target, along with contextual information such as the containing class, uncovered regions, survived mutants, and related tests. It is also associated with the generation context that produced it, including the model, prompt, generation strategy, context mode, attempt number, history setting, and repair budget. After generation, TestMap validates the candidate in the target repository and records evidence from build and execution, coverage, mutation testing, code metrics, test smell detection, failure diagnostics, and repair attempts.
Test Generation
TestMap uses a decomposed generation pipeline, inspired by RUG, rather than asking the model to produce a complete test in a single prompt. For each selected source target, TestMap first constructs an evidence package from the repository database. This package includes the target source code, related tests, test framework information, coverage or mutation gaps, test-class context, helper/setup members, dependencies, and available quality metadata. The evidence package is then converted into a test generation request.
The generation pipeline may optionally build a context graph and resolve that graph into prompt-level construction hints. These steps are deterministic preprocessing steps: they organize available source, test, fixture, dependency, and metric evidence before model generation begins. The model-facing generation sequence then proceeds through a series of planning steps. Under the NoHistory context mode, each step is prompted independently using the selected evidence and relevant previous artifacts supplied explicitly in the prompt. Under the ChainedHistory context mode, TestMap also carries a conversation transcript forward so that later steps can condition on earlier model decisions.
For experiment runs, TestMap persists the generation steps associated with each attempt, including the step type, status, prompt, response, response format, structured response when available, prompt version, validation status, token counts, duration, and error or skip metadata. Some steps may be disabled or represented by deterministic fallback artifacts rather than model responses. Repair attempts are stored as separate generation attempts linked to the original candidate.
Repository-Specific Experiments
TestMap treats test generation as a repository-specific process rather than a model-only benchmark. The same prompt or model can behave differently across repositories because projects differ in test frameworks, fixture conventions, dependency structure, build requirements, coverage gaps, mutation profile, and existing test style. For this reason, TestMap records experiments at the level of a concrete repository revision and evaluates generated candidates in the target repository itself.
Each experiment is associated with repository provenance, including the repository identifier, branch, commit hash, discovered solution or project files, target framework, and baseline execution results. Candidate selection is performed against this repository state. In the current workflow, TestMap selects source methods using configurable evidence such as baseline coverage, surviving mutants, related tests, static metrics, and risk or metric-opportunity scores. Each selected method becomes a target for test candidate generation.
An experiment expands these targets across a generation matrix. Matrix dimensions may include the model provider, generation approach, metrics path, context mode, generation budget, temperature, and enabled generation steps. For example, one experiment may compare naive prompting against metrics-driven prompting, coverage-only evidence against mutation-aware evidence, or independent-step prompting against chained-history prompting. Step-ablation experiments disable selected planning stages to estimate their contribution to candidate outcomes.
For each matrix item and target method, TestMap executes a generation budget. A pass@1 configuration produces one candidate. A pass@k configuration produces multiple independent candidates. A repair configuration first generates an initial candidate and then performs bounded repair attempts using validation diagnostics from earlier attempts. Repair prompts may include compiler errors, structured build diagnostics, test failures, assertion failures, runtime logs, coverage feedback, and the prior generation transcript when chained history is enabled.
Generated candidates are inserted into the target repository, validated, executed, measured, and then rolled back between attempts when the experiment uses an isolated rollback workspace. TestMap persists every attempt rather than only the best passing candidate. For each attempt it records the generated code, generated method name, prompts, model responses, step metadata, token counts, validation diagnostics, execution results, coverage and mutation deltas, repair linkage, and final pipeline outcome. This makes failed, low-impact, repaired, and evidence-positive candidates available for later analysis.
Failed Candidates as Evidence
Failed generated tests should not always be treated as discarded model outputs. A failing candidate may reflect an invalid oracle, missing context, or a model limitation, but it may also expose ambiguous behavior, an implementation defect, or a weakness in the generation pipeline. This is especially important for source-driven test generation. If a tool keeps only generated tests that pass, it may bias the process toward tests that confirm the current implementation rather than tests that challenge it. Recent work similarly suggests that design choices in FM-assisted test generation tools can cause bug-revealing tests to be discarded or can lead generated tests to validate faulty implementation behavior.
TestMap preserves failed and repaired candidates as first-class evidence. These outcomes can help distinguish candidate errors from model limitations, toolchain issues, ambiguous behavior, and possible defects in the system under test. They also reveal the cost of generation: a passing candidate produced after multiple failures and repairs provides different evidence than a candidate that validates on the first attempt.
Conclusion
Foundation-model-assisted test generation does not eliminate the difficulty of software testing; it shifts the challenge toward validating, measuring, repairing, and interpreting generated test candidates. This shift is especially important because generated tests are both code artifacts and validation artifacts: they must be trusted before they can be used to support trust in the system under test.
This paper presented TestMap, an open-source infrastructure prototype for evidence-backed FM-assisted test generation. TestMap records the lifecycle of generated test candidates by connecting repository context, source-test mappings, baseline execution, static metrics, test smells, coverage, mutation testing, validation outcomes, failure histories, repair attempts, and generation metadata. By preserving failed, repaired, and passing candidates, TestMap supports candidate-level review and repository-specific comparison of models, prompts, and generation strategies.
We envision future FM-assisted testing tools that not only generate tests, but also provide the evidence needed to decide whether those tests are useful, maintainable, trustworthy, and worth integrating. TestMap is a step toward that evidence infrastructure, complementing standardized benchmarks with repository-specific analysis of generated test behavior.


