Mokav: Execution-driven differential testing with LLMs

It is essential to detect functional differences between programs in various software engineering tasks, such as automated program repair, mutation testing, and code refactoring. The problem of detecting functional differences between two programs can be reduced to searching for a difference exposing test (DET): a test input that results in different outputs on the subject programs. In this paper, we propose Mokav , a novel execution-driven tool that leverages LLMs to generate DETs. Mokav takes two versions of a program (P and Q) and an example test input. When successful, Mokav generates a valid DET, a test input that leads to provably different outputs on P and Q. Mokav iteratively prompts an LLM with a specialized prompt to generate new test inputs. At each iteration, Mokav provides execution-based feedback from previously generated tests until the LLM produces a DET. We evaluate Mokav on 1535 pairs of Python programs collected from the Codeforces competition platform and 32 pairs of programs from the QuixBugs dataset. Our experiments show that Mokav outperforms the state-of-the-art, Pynguin and Differential Prompting, by a large margin. Mokav can generate DETs for 81.7% (1,255/1535) of the program pairs in our benchmark (versus 4.9% for Pynguin and 37.3% for Differential Prompting). We demonstrate that the iterative and execution-driven feedback components of the system contribute to its high effectiveness. • Mokav is the first LLM-based tool for difference exposing test generation • C4DET is a curated dataset of 1,535 pair of programs with small semantic differences. • The iterative execution-driven approach of Mokav outperforms state-of-the-art in differential testing • An example test that guides the LLM about input structure significantly improves the effectiveness.

Authors

Institutions

Publication Details

Journal
Journal of Systems and Software
Published
2025-07-19
DOI
https://doi.org/10.1016/j.jss.2025.112571
Citations
5
Primary Topic
Software Testing and Debugging Techniques
Type
article
Field-Weighted Citation Impact
11.54
Controls
|||
ALL TIME
JAN
FEB
MAR
APR
MAY
JUN
JUL
AUG
SEP
OCT
article

Mokav: Execution-driven differential testing with LLMs

Martin Monperrus, Khashayar Etemadi, Bardia Mohammadi, Zhendong Su
5 citations
Journal of Systems and Software
Software Testing and Debugging Techniques
11.54
article

Mokav: Execution-driven differential testing with LLMs

Martin Monperrus, Khashayar Etemadi, Bardia Mohammadi, Zhendong Su
article en
5 citations

Abstract

It is essential to detect functional differences between programs in various software engineering tasks, such as automated program repair, mutation testing, and code refactoring. The problem of detecting functional differences between two programs can be reduced to searching for a difference exposing test (DET): a test input that results in different outputs on the subject programs. In this paper, we propose Mokav , a novel execution-driven tool that leverages LLMs to generate DETs. Mokav takes two versions of a program (P and Q) and an example test input. When successful, Mokav generates a valid DET, a test input that leads to provably different outputs on P and Q. Mokav iteratively prompts an LLM with a specialized prompt to generate new test inputs. At each iteration, Mokav provides execution-based feedback from previously generated tests until the LLM produces a DET. We evaluate Mokav on 1535 pairs of Python programs collected from the Codeforces competition platform and 32 pairs of programs from the QuixBugs dataset. Our experiments show that Mokav outperforms the state-of-the-art, Pynguin and Differential Prompting, by a large margin. Mokav can generate DETs for 81.7% (1,255/1535) of the program pairs in our benchmark (versus 4.9% for Pynguin and 37.3% for Differential Prompting). We demonstrate that the iterative and execution-driven feedback components of the system contribute to its high effectiveness. • Mokav is the first LLM-based tool for difference exposing test generation • C4DET is a curated dataset of 1,535 pair of programs with small semantic differences. • The iterative execution-driven approach of Mokav outperforms state-of-the-art in differential testing • An example test that guides the LLM about input structure significantly improves the effectiveness.

Journal of Systems and SoftwareVol. 230
Sharif University of Technology (IR), ETH Zurich (CH), KTH Royal Institute of Technology (SE)
Openalex Percentile: Top 2%
Software Testing and Debugging Techniques
11.54
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.

Mokav: Execution-driven differential testing with LLMs — Martin Monperrus, Khashayar Etemadi, et al. · Journal of Systems and Software (2025) | TGRS Research Map | TGRS