Replication package for the paper:
Junda Zhao, Shurui Zhou, and Eldan Cohen. Do Coverage and Mutation Scores of LLM-Generated Test Suites Correlate with Their Effectiveness? (Replicability Study). Proceedings of the ACM on Software Engineering 3, ISSTA, Article ISSTA002 (2026). DOI: 10.1145/3832093
The paper is a large-scale conceptual replication of Inozemtseva et al. (ICSE 2014) and Papadakis et al. for LLM-generated test suites: do coverage and mutation scores still predict real-bug detection, and is test-suite size still the dominant confounder? The study covers 11 LLMs (13 model settings), 318 buggy focal methods across all 17 Defects4J projects, and 8,268 generated test suites (over 100,000 test cases), with tests generated from both the fixed (regression-style) and the buggy version of each focal method.
Measurement per test suite: statement, branch, and modified condition (MC/DC) coverage via CodeCover; raw and normalized mutation scores via PIT; real-bug detection = the suite contains at least one test that passes on the fixed version but fails on the buggy one. Correlations are computed with Pearson r and Kendall τ-b over 1,000 randomly sampled 100-method suites per model, in unconstrained and size-controlled (3/5/10 tests per suite) settings.
The prompt-construction and evaluation harness is adapted from the LLM4UT artifact of Yang et al. (ASE 2024).
All processed per-focal-method statistics are included, so the paper's analyses can be reproduced directly:
data/rq1/fixed_log_per_item/anddata/rq1/buggy_log_per_item/— one CSV per LLM (all generated tests), one row per focal method, with compilation counts, bug-detection outcomes, coverage (statement/branch/MC-DC), and mutation results (33 columns).data/rq1/{fixed,buggy}_log_per_item_{3,5,10}_test/— the size-controlled variants (3/5/10 tests per suite).
Note: in the per-item CSV logs, the Line covered / Line missed / Line coverage (%) columns record CodeCover statement coverage — the metric the paper calls statement coverage. Likewise, Covered Mutation Score (%) is the paper's normalized mutation score (killed mutants ÷ mutants covered by the suite).
Run analyze_sampled_fixed.ipynb (tests generated from bug-free code) and analyze_sampled_buggy.ipynb (tests generated from buggy code) with the Jupyter working directory set to this repository's root. Both notebooks run purely on the CSVs — no Defects4J, no API keys. Cells must be executed top to bottom (later cells reuse variable names). Configuration variables:
num_test— test-suite size setting:3,5,10, orNone(all generated tests). Must match one of thedata/rq1/...directories above.all_model_names— the subset of LLMs to analyze (names must match the CSV filename prefixes, e.g.Claude-4-Sonnet).num_samples/sample_size— the sampling parameters (paper setting: 1,000 samples of 100 focal methods; sampling is seeded per model, so results are reproducible).- For the inter-model view, set
num_samples = 1andsample_size = 318to aggregate over all focal methods per model.
Figures are written to issta_replicability_study/; correlation tables are shown inline. Note that the four camera-ready boxplot cells near the end of analyze_sampled_fixed.ipynb plot per-model correlation values transcribed from the paper's tables (obtained by running the notebook once per model) — they do not recompute from the loaded data.
The full pipeline used to produce the CSVs above. This requires a working Defects4J v3.0 installation, Java 11, and an LLM API key.
- Install Defects4J and verify it works.
- Download the extra test-framework JARs into the Defects4J shared library directory:
bash download_dependencies.sh /path/to/defects4j
- Run download_jar.ipynb for the remaining JARs — edit
LIB_DIRat the top to/path/to/defects4j/framework/projects/libfirst. - From the repository root, check out all Defects4J projects (creates
d4j_proj_base/<Project>_<bug>/{buggy,fixed}/; slow, and needs substantial disk space):bash checkout_all.sh
- Create the conda environment:
conda env create -f environment.yml conda activate LLM4UT
- In data/configuration.py, replace the two placeholders:
/path/to/defects4j(your Defects4J installation) and/path/to/repo(this repository's absolute path). CodeCover, PIT, and JUnit paths already resolve relative to the repo — the tools are bundled underutils/.
Everything else uses paths relative to the repository root, so always start Jupyter from there. Importing data/configuration.py compiles the bundled tree-sitter grammar into data/build/java.so on first use.
- Build the source data with generate_source_data_for_prompt.ipynb. Set
version = 'buggy', run, then rerun withversion = 'fixed'. This parses every checked-out bug listed indata/d4j2_fix_info/and writesdata/prompts/{version}_source_data_draft.jsonl. The early cells are an optional single-bug walkthrough (hardcoded toTime_12); the batch pipeline is the loop near the end. - Unify the datasets with unify_fixed_and_buggy_bugs.ipynb — filters to public/protected focal methods present in both versions and writes
data/prompts/{version}_source_data_unified_invoked.jsonl. - Build the prompts with generate_prompt.ipynb. Set
tgt_model,version, andfile_post_fix, and point the input path at the unified file from step 2 (the default input filename carries a_with_docstringsuffix inherited from a sibling project; this paper's prompts embed the focal-method code, and the formatter is called withwith_code=True, with_docstring=False). Prompts are written todata/prompts/rq1/. - Generate the tests with UT_Test_Generation.ipynb. Set your API key in the first cells and match
tgt_model/version/file_post_fixto step 3. The API model is hardcoded (model="o4-mini",reasoning_effort="high") in the API-call cells — change the model string and client for the LLM you want to evaluate. Output:data/prompts/rq1/*_with_completion.jsonl. - Compile, run, and measure with UT_Compile_and_Test_fixed_project.ipynb (tests generated from fixed code) and UT_Compile_and_Test_Project.ipynb (tests generated from buggy code). Each suite is assembled into a compilable JUnit class (with iterative repair), injected into both the fixed and buggy checkouts, executed via
defects4j test, and measured with JaCoCo, CodeCover (MC/DC), and PIT (mutation). Thetest_per_suitevariable controls the size-controlled settings (set it to the suite size you want; falsy keeps all tests). Per-focal-method results are appended todata/rq1/log_per_item/*_log_per_item.jsonl(execution logs go todata/rq1/logs/). - Convert logs to CSVs with clean_log_per_item_file.ipynb. Move the JSONLs from step 5 into a
data/rq1/{version}_log_per_item_{N}_test/directory matching thetest_per_suiteyou used (the notebook'slog_per_item_rootvariable selects the directory), then run it — it writes one cleaned CSV next to each JSONL. - Analyze with the two
analyze_sampled_*.ipynbnotebooks as described above, pointingnum_testat your directory.
Prompt_example/Test_Generation_Prompt is a complete example of the test-generation prompt used in the study (focal method code plus surrounding class context).
This package is permanently archived on Zenodo: 10.5281/zenodo.21429528 (all versions). To cite the paper:
@article{zhao2026covmut,
author = {Zhao, Junda and Zhou, Shurui and Cohen, Eldan},
title = {Do Coverage and Mutation Scores of {LLM}-Generated Test Suites Correlate with Their Effectiveness? (Replicability Study)},
journal = {Proceedings of the ACM on Software Engineering},
volume = {3},
number = {ISSTA},
articleno = {ISSTA002},
year = {2026},
publisher = {Association for Computing Machinery},
doi = {10.1145/3832093}
}This package is released under the MIT License. Bundled third-party tools (PIT, CodeCover, JaCoCo, JUnit, Apache Commons) and code adapted from LLM4UT retain their original licenses — see NOTICE.
- The prompt-construction and evaluation harness is adapted from the LLM4UT artifact of Yang et al., On the Evaluation of Large Language Models in Unit Test Generation (ASE 2024).
- Bug data from Defects4J.
- Replicated studies: Inozemtseva and Holmes, Coverage Is Not Strongly Correlated with Test Suite Effectiveness (ICSE 2014); Papadakis et al., Are Mutation Scores Correlated with Real Fault Detection? (ICSE 2018).