https://github.com/assert-kth/mokav
Generating difference exposing tests in Python http://arxiv.org/pdf/2406.10375
Science Score: 49.0%
This score indicates how likely this project is to be science-related based on various indicators:
-
○CITATION.cff file
-
✓codemeta.json file
Found codemeta.json file -
✓.zenodo.json file
Found .zenodo.json file -
✓DOI references
Found 1 DOI reference(s) in README -
✓Academic publication links
Links to: arxiv.org -
○Academic email domains
-
○Institutional organization owner
-
○JOSS paper metadata
-
○Scientific vocabulary similarity
Low similarity (15.6%) to scientific vocabulary
Repository
Generating difference exposing tests in Python http://arxiv.org/pdf/2406.10375
Basic Info
Statistics
- Stars: 6
- Watchers: 1
- Forks: 0
- Open Issues: 2
- Releases: 0
Metadata Files
README.md
Mokav!
This project introduces an innovative approach for iterative test generation using large language models (LLMs). Instead of relying on traditional techniques, our approach leverages the power of LLMs to generate test cases that target behavioral differences between a buggy program version and an accepted/patched program version. By engaging in interactive conversations with the LLM, our method provides feedback to steer the generation process iteratively until a fault-inducing test is found.
Mokav: Execution-driven Differential Testing with LLMs (Khashayar Etemadi, Bardia Mohammadi, Zhendong Su and Martin Monperrus), Journal of Systems and Software, 2025.
bibtex
article{mokav,
title = {Mokav: Execution-driven Differential Testing with LLMs},
year = {2025},
author = {Khashayar Etemadi and Bardia Mohammadi and Zhendong Su and Martin Monperrus},
journal = {Journal of Systems and Software},
doi = {10.1016/j.jss.2025.112571},
}
Requirements
- Python 3 installed (Code has been tested with Python 3.10.12 on Ubuntu 22.04)
- Packages indicated in
requirements.txtinstalled on python execution environments. - For running code-llama, an NVIDIA A100 GPU was used. Please ensure you have a compatible GPU and the necessary drivers installed.
Installation
- Clone the repository
- Install the required packages using the following command:
bash pip install -r requirements.txt
Configuration
Before running the program, you need to add your OpenAI API key to a .env file in the project root directory. Here's how you can do it:
Create a new file named
.envin the project root directory.Open the
.envfile and add the following line:
bash
OPENAI_API_KEY=your_api_key_here
Command-Line Arguments
The script accepts the following command-line arguments:
-for--is_func: This argument is used to run the C4DET runner. It is set toTrueby default.-qor--is_qb: This argument is used to run the QuixBugs runner. It is set toFalseby default.-icor--iteration_count: This argument specifies the number of iterations after the initial prompt. The default value is9.-mcor--meta_data_config: This argument is used to set the configuration for meta data. The choices are "BADT", "AADT", "AADTI", "BAT", "AAT", "BATI", "AATI", "BADTI", "BADTIE", "BATIE". The default value is "BADTIE".-tdor--generated_tests_dir: This argument specifies the directory to write the generated tests. The default directory is "generated_tests".-nsor--number_of_samples: This argument specifies the number of samples to be generated at each iteration. The default value is10.-tmor--temperature: This argument sets the temperature. The default value is1.
All arguments are optional. If not provided, the default values will be used.
Usage
Ensure that your datasets are located in the
/data/directory. The directory should include both Quixbugs and C4DET programs.Run the following command to generate test cases for a given buggy program:
bash python main.py -ic 9 -mc BADTIE -td generated_tests -ns 10 -tm 1The generated test cases will be saved in the specified output directory.
Owner
- Name: ASSERT
- Login: ASSERT-KTH
- Kind: organization
- Location: Sweden
- Website: https://github.com/ASSERT-KTH/
- Repositories: 87
- Profile: https://github.com/ASSERT-KTH
assertEquals("Research group at KTH Royal Institute of Technology, Stockholm, Sweden", description);
GitHub Events
Total
- Watch event: 3
- Push event: 6
Last Year
- Watch event: 3
- Push event: 6