Lune

ASE2024Top-tier venue

Effective Unit Test Generation for Java Null Pointer Exceptions

Myungho Lee, Jiseong Bak, Seokhyeon Moon, Yoonchan Jhi, Hakjoo Oh

Abstract

In this experience paper, we share our experience on enhancing automatic unit test generation to more effectively find Java null pointer exceptions (NPEs). NPEs are among the most common and critical errors in Java applications. However, as we demonstrate in this paper, existing unit test generation tools such as Randoop and EvoSuite are not sufficiently effective at catching NPEs. Specifically, their primary strategy of achieving high code coverage does not necessarily result in triggering diverse NPEs in practice. In this paper, we detail our observation on the limitations of current state-of-the-art unit testing tools in terms of NPE detection and introduce a new strategy to improve their effectiveness. Our strategy utilizes both static and dynamic analyses to guide the test case generator to focus specifically on scenarios that are likely to trigger NPEs. We implemented this strategy on top of EvoSuite, and evaluated our tool, NpeTest, on 108 NPE benchmarks collected from 96 real-world projects. The results show that our NPE-guidance strategy can increase EvoSuite's reproduction rate of the NPEs from 56.9% to 78.9%, a 38.7% improvement. Furthermore, NpeTest successfully detected 89 previously unknown NPEs from an industry project.

Ask Lune

Know this paper in minutes, not an afternoon.

Lune can read every page of it and the top-tier papers that cite it, and gives you its claims, its evidence and its limits, each one cited to the paper it comes from. No skimming, no AI slop.

2 top-tier papers have cited it since. Know what they found before your reviewers do.

Questions to start from

Lune can draw on

the full paper · the top-tier papers that cite it · related work

Get the answer

Free to start. No credit card required.

Lineage

  • UnitCon: Synthesizing Targeted Unit Tests for Java Runtime Exceptions cites Graph-based seed object synthesis for search-based unit testing
  • UnitCon: Synthesizing Targeted Unit Tests for Java Runtime Exceptions cites NPEX: Repairing Java Null Pointer Exceptions without Tests
Builds onCited byLeft to right by year; the more cited, the higher.

Cited by top-tier papers2

  1. Reflective Unit Test Generation for Precise Type Error Detection with Large Language ModelsChen Yang, Ziqi Wang, Yanjie Jiang, Lin Yang et al.ASE 2025 · 1 citation
  2. UnitCon: Synthesizing Targeted Unit Tests for Java Runtime ExceptionsSujin Jang, Yeonhee Ryou, Heewon Lee, Kihong HeoFSE 2025

Builds on5

  1. On the Reliability of Coverage-Based Fuzzer BenchmarkingMarcel Böhme, László Szekeres, Jonathan MetzmanICSE 2022 · 91 citations
  2. Graph-based seed object synthesis for search-based unit testingYun Lin, You Sheng Ong, Jun Sun, Gordon Fraser et al.FSE 2021 · 34 citations
  3. On the Real-World Effectiveness of Static Bug Detectors at Finding Null Pointer ExceptionsDavid A. Tomassi, Cindy Rubio-GonzálezASE 2021 · 24 citations
  4. NPEX: Repairing Java Null Pointer Exceptions without TestsJunhee Lee, Seongjoon Hong, Hakjoo OhICSE 2022 · 13 citations
  5. Practical Inference of Nullability TypesNima Karimipour, Justin Pham, Lazaro Clapp, Manu SridharanFSE 2023 · 6 citations

Related papers

  1. Automatic Unit Test Generation for Machine Learning Libraries: How Far Are We?Song Wang, Nishtha Shrestha, Abarna Kucheri Subburaman, Junjie Wang et al.ICSE 2021 · 36 citations
  2. Increasing the Effectiveness of Automatically Generated Tests by Improving Class ObservabilityGeraldine Galindo-Gutierrez, Juan Pablo Sandoval Alcocer, Nicolas Jimenez-Fuentes, Alexandre Bergel et al.ICSE 2025 · 1 citation
  3. Call Me Maybe: Using NLP to Automatically Generate Unit Test Cases Respecting Temporal ConstraintsArianna Blasi, Alessandra Gorla, Michael D. Ernst, Mauro PezzèASE 2022 · 22 citations
  4. Do Automatic Test Generation Tools Generate Flaky Tests?Martin Gruber, Muhammad Firhard Roslan, Owain Parry, Fabian Scharnböck et al.ICSE 2024 · 12 citations
  5. FailMapper: Automated Generation of Unit Tests Guided by Failure ScenariosRuiqi Dong, Zehang Deng, Xiaogang Zhu, Xiaoning Du et al.ASE 2025
Dusk over the sea between two cliffs drawn in fine vertical lines