Developing an Intelligent and Context-Aware Framework for Automated Software Test Case Generation and Coverage Optimization Using Large Language Models

Large language models (LLMs) can write readable unit tests, but most test generators that use them rely on large hosted models, and feedback loops designed for such models help little when only a small local model can be used. This paper presents CAMEO (Context-Aware, Mutation- and Execution-guided Optimisation), a framework that treats unit test generation as the maximisation of one coverage-and-mutation objective under a budget of model calls. The objective is monotone submodular, which yields approximation guarantees for selecting the final suite. CAMEO combines a context-aware first prompt, oracles taken from execution, goal-structured feedback that ranks open targets by a Bayesian posterior expected gain, a search stage that mutates valid inputs within invariants inferred from the model’s own tests, and objective-preserving suite selection. CAMEO was evaluated with Qwen2.5-Coder-0.5B on a CPU, using 332 programs from HumanEval, with human-written bugs from HumanEvalFix, and TestEval, against five re-implemented LLM-based strategies under the same budget of three calls. CAMEO reached the highest mean mutation score on held-out mutants (0.776) and detected the most bugs (94.8%). It was significantly better than Repair, CoverUp-style, MuTAP-style and SymPrompt-style prompting, and it matched basic sampling while using 2.24 calls on average. After one call, its TestEval branch coverage was 0.768 against 0.677, and on TestEval runs where every method produced a valid test it raised branch coverage from 0.909 to 0.967. Selection shortened the suites by about two thirds without losing coverage. The results show that small models benefit most from execution feedback, cheap search and single-goal prompts.

Authors

Institutions

Publication Details

Journal
Journal of Al-Farabi For Engineering Sciences
Published
2026-12-01
DOI
https://doi.org/10.59746/8t32q897
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
NOV
article

Developing an Intelligent and Context-Aware Framework for Automated Software Test Case Generation and Coverage Optimization Using Large Language Models

Janan Farag Yonan
Journal of Al-Farabi For Engineering Sciences
Software Testing and Debugging Techniques
article

Developing an Intelligent and Context-Aware Framework for Automated Software Test Case Generation and Coverage Optimization Using Large Language Models

Janan Farag Yonan
article en

Abstract

Large language models (LLMs) can write readable unit tests, but most test generators that use them rely on large hosted models, and feedback loops designed for such models help little when only a small local model can be used. This paper presents CAMEO (Context-Aware, Mutation- and Execution-guided Optimisation), a framework that treats unit test generation as the maximisation of one coverage-and-mutation objective under a budget of model calls. The objective is monotone submodular, which yields approximation guarantees for selecting the final suite. CAMEO combines a context-aware first prompt, oracles taken from execution, goal-structured feedback that ranks open targets by a Bayesian posterior expected gain, a search stage that mutates valid inputs within invariants inferred from the model’s own tests, and objective-preserving suite selection. CAMEO was evaluated with Qwen2.5-Coder-0.5B on a CPU, using 332 programs from HumanEval, with human-written bugs from HumanEvalFix, and TestEval, against five re-implemented LLM-based strategies under the same budget of three calls. CAMEO reached the highest mean mutation score on held-out mutants (0.776) and detected the most bugs (94.8%). It was significantly better than Repair, CoverUp-style, MuTAP-style and SymPrompt-style prompting, and it matched basic sampling while using 2.24 calls on average. After one call, its TestEval branch coverage was 0.768 against 0.677, and on TestEval runs where every method produced a valid test it raised branch coverage from 0.909 to 0.967. Selection shortened the suites by about two thirds without losing coverage. The results show that small models benefit most from execution feedback, cheap search and single-goal prompts.

Journal of Al-Farabi For Engineering SciencesVol. 5(1)
University of Information Technology and Communications (IQ)
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.

Laika access coming soon
Developing an Intelligent and Context-Aware Framework for Automated Software Test Case Generation and Coverage Optimization Using Large Language Models — Janan Farag Yonan · Journal of Al-Farabi For Engineering Sciences (2026) | TGRS Research Map | TGRS