Skip to content

About

Replication package for 'Do Coverage and Mutation Scores of LLM-Generated Test Suites Correlate With Their Effectiveness? (Replicability Study)' (ISSTA 2026)

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Latest commit

 

History

5 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Do Coverage and Mutation Scores of LLM-Generated Test Suites Correlate With Their Effectiveness?

DOI

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).

Reproducing the paper's results (no test generation needed)

All processed per-focal-method statistics are included, so the paper's analyses can be reproduced directly:

  • data/rq1/fixed_log_per_item/ and data/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, or None (all generated tests). Must match one of the data/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 = 1 and sample_size = 318 to 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.

Generating and evaluating your own test suites

The full pipeline used to produce the CSVs above. This requires a working Defects4J v3.0 installation, Java 11, and an LLM API key.

Setup

  1. Install Defects4J and verify it works.
  2. Download the extra test-framework JARs into the Defects4J shared library directory:
    bash download_dependencies.sh /path/to/defects4j
  3. Run download_jar.ipynb for the remaining JARs — edit LIB_DIR at the top to /path/to/defects4j/framework/projects/lib first.
  4. 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
  5. Create the conda environment:
    conda env create -f environment.yml
    conda activate LLM4UT
  6. 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 under utils/.

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.

Pipeline

  1. Build the source data with generate_source_data_for_prompt.ipynb. Set version = 'buggy', run, then rerun with version = 'fixed'. This parses every checked-out bug listed in data/d4j2_fix_info/ and writes data/prompts/{version}_source_data_draft.jsonl. The early cells are an optional single-bug walkthrough (hardcoded to Time_12); the batch pipeline is the loop near the end.
  2. 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.
  3. Build the prompts with generate_prompt.ipynb. Set tgt_model, version, and file_post_fix, and point the input path at the unified file from step 2 (the default input filename carries a _with_docstring suffix inherited from a sibling project; this paper's prompts embed the focal-method code, and the formatter is called with with_code=True, with_docstring=False). Prompts are written to data/prompts/rq1/.
  4. Generate the tests with UT_Test_Generation.ipynb. Set your API key in the first cells and match tgt_model/version/file_post_fix to 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.
  5. 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). The test_per_suite variable controls the size-controlled settings (set it to the suite size you want; falsy keeps all tests). Per-focal-method results are appended to data/rq1/log_per_item/*_log_per_item.jsonl (execution logs go to data/rq1/logs/).
  6. 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 the test_per_suite you used (the notebook's log_per_item_root variable selects the directory), then run it — it writes one cleaned CSV next to each JSONL.
  7. Analyze with the two analyze_sampled_*.ipynb notebooks as described above, pointing num_test at your directory.

Prompt example

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).

Citation

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}
}

License

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.

Acknowledgments

  • 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).

About

Replication package for 'Do Coverage and Mutation Scores of LLM-Generated Test Suites Correlate With Their Effectiveness? (Replicability Study)' (ISSTA 2026)

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages