<scp>JSTestCraft</scp> : Addressing Context Deficits in JavaScript Unit Test Generation via Agentic Multi-Level Contextual Analysis

Unit testing is crucial for software reliability in JavaScript, yet constructing comprehensive suites remains costly and error-prone. JavaScript’s dynamic features, flexible typing, asynchronous execution, and reliance on third-party libraries, pose persistent challenges for automated test generation. Although large language models (LLMs) show promise in code reasoning and synthesis, existing methods often miss the multilayer contextual information required for executable, semantically correct tests. This paper introduces JSTestCraft , an agentic, multi-layer framework for adaptive JavaScript unit test generation. JSTestCraft reconstructs missing context via three enrichment agents: library, structural, and semantic. These agents capture inter-function topology, third-party API semantics, and inferred type constraints in a shared contextual memory for reasoning-driven test synthesis. A testing and optimization layer generates, executes, and iteratively refines test cases. Evaluated on 20 real-world Node.js repositories, JSTestCraft outperforms state-of-the-art baselines, improving test pass rate by 60.9% , statement coverage by 14.2% , and branch coverage by 47.3% . Ablation analysis confirms each agent’s contribution to contextual completeness. Beyond metrics, JSTestCraft discovers 13 previously unknown bugs across 5 repositories, 6 of which received substantive acknowledgment from maintainers or community contributors. These results demonstrate that context reconstruction and agentic collaboration enable LLMs to perform more reliable and adaptive testing in dynamic JavaScript environments.

Authors

Institutions

Publication Details

Journal
ACM Transactions on Software Engineering and Methodology
Published
2026-07-28
DOI
https://doi.org/10.1145/3828725
Primary Topic
Software Testing and Debugging Techniques
Type
article
Field-Weighted Citation Impact
0.00
Controls
|||
ALL TIME
JAN
FEB
MAR
APR
MAY
JUN
JUL
AUG
SEP
OCT
article

JSTestCraft : Addressing Context Deficits in JavaScript Unit Test Generation via Agentic Multi-Level Contextual Analysis

Yiyang Liu, Yanjie Zhao, Haoyu Wang
ACM Transactions on Software Engineering and Methodology
Software Testing and Debugging Techniques
article

JSTestCraft : Addressing Context Deficits in JavaScript Unit Test Generation via Agentic Multi-Level Contextual Analysis

Yiyang Liu, Yanjie Zhao, Haoyu Wang
article en

Abstract

Unit testing is crucial for software reliability in JavaScript, yet constructing comprehensive suites remains costly and error-prone. JavaScript’s dynamic features, flexible typing, asynchronous execution, and reliance on third-party libraries, pose persistent challenges for automated test generation. Although large language models (LLMs) show promise in code reasoning and synthesis, existing methods often miss the multilayer contextual information required for executable, semantically correct tests. This paper introduces JSTestCraft , an agentic, multi-layer framework for adaptive JavaScript unit test generation. JSTestCraft reconstructs missing context via three enrichment agents: library, structural, and semantic. These agents capture inter-function topology, third-party API semantics, and inferred type constraints in a shared contextual memory for reasoning-driven test synthesis. A testing and optimization layer generates, executes, and iteratively refines test cases. Evaluated on 20 real-world Node.js repositories, JSTestCraft outperforms state-of-the-art baselines, improving test pass rate by 60.9% , statement coverage by 14.2% , and branch coverage by 47.3% . Ablation analysis confirms each agent’s contribution to contextual completeness. Beyond metrics, JSTestCraft discovers 13 previously unknown bugs across 5 repositories, 6 of which received substantive acknowledgment from maintainers or community contributors. These results demonstrate that context reconstruction and agentic collaboration enable LLMs to perform more reliable and adaptive testing in dynamic JavaScript environments.

ACM Transactions on Software Engineering and Methodology
Huazhong University of Science and Technology (CN)
Partnerships for the goals
Openalex Percentile: Top 4%
Software Testing and Debugging Techniques
AI Navigator

Ask Laika to Summarize, Analyze, and Connect papers live on the map.

Summarize Papers & Methodologies

Extract key findings, datasets, and comparative methods across publications.

Benchmark Rankings & Visual Analytics

Rank top research institutions, authors, funders, topics, and journals by Field-Weighted Citation Impact (FWCI) and paper volume with instant charts.

Connect Distant Disciplines

Bridge topological clusters on the map to find hidden collaborative intersections.

<scp>JSTestCraft</scp> : Addressing Context Deficits in JavaScript Unit Test Generation via Agentic Multi-Level Contextual Analysis — Yiyang Liu, Yanjie Zhao, et al. · ACM Transactions on Software Engineering and Methodology (2026) | TGRS Research Map | TGRS