Skip to content

testmigrator/intenttest

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

13 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Project logo IntentTester: Intent-Driven Multi-Agent Framework for Cross-Library Test Migration

IntentTester is the prototype implementation of our ongoing research on intent-driven multi-agent test migration.

📑 Table of Contents

📝 Description

This project introduces a multi-agent framework that enables automated migration of unit tests across libraries and programming languages. By modeling test intent and leveraging repository graphs, IntentTester improves:

  • Syntactic correctness of migrated tests.
  • Execution success across different ecosystems.
  • Defect discovery in real-world software libraries.

Pipeline

🚀 GettingStarted

Requirements

  • Python 3.9+
  • Java JDK 11+
  • Neo4j (for repository graph construction)

Installation

python -m venv venv
pip install -r requirements.txt

Configuration

You need to specify parameter configurations in the task.properties file.
This file is located under the src/main/resources

# Domain of the experiment (e.g., html, json, time)
domain=html

# Path to the source repository (recommended: place under the project "input" directory)
sourceRepoFilepath=demo/jsoup-master

# Programming language of the source repository
# Currently supported: Java, Python (JavaScript support is under development — stay tuned!)
sourceRepoLanguage=Java

# Path to the target repository (recommended: place under the project "input" directory)
targetRepoFilepath=demo/jfiveparse-master

# Programming language of the target repository
targetRepoLanguage=Java

# LLM service configuration
# For data security, you may also set the API key via environment variables
apiKey=
modelName=

💡 The default common.LLMService is a basic LLM service. You can replace it with any other LLM provider as needed.

ProjectStructure

📖 Directory Overview

Directory / Module Description
assets/ Icons, figures, and images for documentation and paper presentation.
datasets/ Experimental datasets used in our evaluation.
python/ Auxiliary scripts (graph construction, repository search, etc.).
src/Orchestrator/ Orchestrator for coordinating interactions among multiple agents.
src/antlr/ Grammar parsers for Java, Python, and other supported languages.
src/entity/ Defines entities such as repository graph, context bundles, test intents.
src/utils/ General-purpose utilities (logging, file I/O, etc.).
src/common/ LLM integration layer, prompt templates, task parameter configuration.
src/framework/ Core multi-agent framework (agent definitions, orchestration, execution).
└── preprocessing/ Builds repository graphs for the target project.
└── service/ Agent service toolkit: test extraction, TDL parsing, intermediate results.
resources/ Project configuration files (e.g., task.properties).

🧪 Experiments

We provide scripts to reproduce the experiments from the paper:
RQ1: Migration correctness evaluation
RQ2: Execution success rate
RQ3: Defect discovery analysis
RQ4: Ablation study of multi-agent components

📊 Datasets

The complete dataset is available in the datasets directory, containing the source code for all projects used in the paper.

Test Migration Directions

🟦 JSON
Source Target
gson nanojson
gson simplejson
simplejson gson
simplejson nanojson
nanojson gson
nanojson simplejson
🟩 HTML
Source Target
jfiveparse domonic
jfiveparse jsoup
domonic jfiveparse
domonic jsoup
jsoup domonic
jsoup jfiveparse
🟨 Time
Source Target
maya threetenbp
maya time4j
threetenbp maya
threetenbp time4j
time4j maya
time4j threetenbp

📈 Result

  • The demo/ directory contains a toy example of intent-based test migration.
  • The results/ directory provides all experimental data reported in the paper.

The figure below shows the distribution of execution outcomes for migrated intent tests across different repositories,
highlighting the proportion of successful and failed runs.

result

Reconstruction quality from TDL:
histogram (left) and ECDF (right) of AST Jaccard similarity, evidencing high fidelity; lower scores mainly reflect LLM refinements rather than semantic loss.

tdl

💻 Usage

This section describes how to run IntentTester for cross-library test migration.
The process involves two main stages: repository graph construction and intent-based test migration.


🔹 Step 1: Preprocessing - Repository Graph Construction

Run the framework/preprocessing/RepoGraphConstruction class.

This step builds a repository graph for the target project, which is essential for enabling intent-driven test migration.

  • The graph encodes entities such as APIs, methods, classes, and dependencies, along with their relations.
  • It provides the structural context needed by downstream agents to align and migrate tests.

⚠️ Note:

  • Graph construction can be time-consuming depending on repository size.
  • However, this step only needs to be performed once per target project.

🔹 Step 2: Intent Test Migration

Run the Main class. The migration is powered by the multi-agent orchestrator, which coordinates multiple specialized agents:

  1. IntentAbstractorAgent
    Extracts tests from the source repository and abstracts them into test intents.

  2. IntentAlignmentAgent
    Aligns test intents with the target repository by constructing a context bundle using the repository graph.

  3. PlanningAgent
    Decides whether a test should be migrated, based on semantic compatibility and context alignment.

  4. TestMigrationAgent
    Performs the actual migration, generating executable test cases for the target repository.

  5. VerificationAgent
    Applies refinement mechanisms to check correctness, filter invalid outputs, and ensure execution validity.

📌 Tips

Ensure the task.properties file is configured correctly before running.
For large repositories, consider allocating more memory to the JVM.
‼️ We are continuously improving the documentation and adding new features. Please stay tuned for updates.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors