Official implementation of the paper: DiffuTester: Accelerating Unit Test Generation for Diffusion LLMs via Mining Structural Pattern
Software development relies heavily on extensive unit testing, making the efficiency of automated Unit Test Generation (UTG) crucial. While diffusion large language models (dLLMs) show promise for efficient parallel test generation, they often face a trade-off between efficiency and generation quality.
💡 DiffuTester is an acceleration method designed for dLLMs in UTG.
The key idea is simple yet powerful: unit tests targeting the same focal method often share structural patterns. By dynamically identifying these patterns through AST analysis during generation, DiffuTester adaptively increases the number of tokens unmasked at each step without sacrificing quality. An overview of DiffuTester is shown below:
pip install -r requirements.txtFor java, you need to install JDK17 and maven.
wget https://download.oracle.com/java/17/archive/jdk-17.0.12_linux-x64_bin.tar.gz
wget https://dlcdn.apache.org/maven/maven-3/3.9.11/binaries/apache-maven-3.9.11-bin.tar.gz
tar -zxvf jdk-17.0.12_linux-x64_bin.tar.gz
tar -zxvf maven-mvnd-1.0.2-linux-amd64.tar.gz
export JAVA_HOME=~/jdk-17.0.12
export PATH=$PATH:$JAVA_HOME/bin
export MAVEN_HOME=~/apache-maven-3.9.11
export PATH=$PATH:$MAVEN_HOME/binFor cpp, you need to support C++20 standard.
After environment preparation, you can run the following command to reproduce the main results in our paper.
./run_all.shNote: to enable acceleration, the evaluation code will replace
generate_utils.pyin the model folder with./generate_utils_diffucoder.py. Please make sure thatgenerate_utils.pyin your model folder is writable.
The dataset used in our paper is in the data folder. You can also download it from Huggingface.
