← Latest papers
💻 computer science

TestWeaver: Execution-aware, Feedback-driven Regression Testing Generation with Large Language Models

TestWeaver is a novel LLM-based regression testing approach that overcomes coverage plateaus by integrating lightweight program analysis—specifically backward slicing, similar test case selection, and execution in-line annotations—to provide focused execution contexts that enhance test generation effectiveness and accelerate code coverage growth.

Original authors: Cuong Chi Le, Cuong Duc Van, Tung Duy Vu, Thai Minh Pham Vu, Hoang Nhat Phan, Huy Nhat Phan, Tien N. Nguyen

Published 2026-01-28
📖 4 min read☕ Coffee break read

Original authors: Cuong Chi Le, Cuong Duc Van, Tung Duy Vu, Thai Minh Pham Vu, Hoang Nhat Phan, Huy Nhat Phan, Tien N. Nguyen

Original paper licensed under CC BY 4.0 (http://creativecommons.org/licenses/by/4.0/). This is an AI-generated explanation of the paper below. It is not written or endorsed by the authors. For technical accuracy, refer to the original paper. Read full disclaimer

Imagine you are trying to teach a very smart, but slightly absent-minded robot (a Large Language Model or LLM) how to break into a specific room in a massive, complex mansion (a computer program). Your goal is to write a set of instructions (a test case) that will get the robot to walk through a specific door (a line of code) that it has never visited before.

The problem is that the mansion is huge. If you give the robot a map of the entire mansion, it gets overwhelmed, confused, and starts guessing. It might walk into the kitchen, then the library, then the garage, but it keeps missing that one specific door in the attic. This is called the "Coverage Plateau": the robot keeps trying, but it stops finding new rooms because it's just wandering around the same familiar halls.

TestWeaver is a new tool designed to fix this. Instead of just handing the robot the whole map and saying, "Go find that door," TestWeaver acts like a super-smart guide who uses three clever tricks to help the robot succeed.

1. The "Spotlight" Trick (Backward Slicing)

Instead of showing the robot the whole mansion, TestWeaver shines a spotlight only on the hallway that leads directly to the target door. It cuts away all the irrelevant rooms, the basement, and the garden.

  • The Metaphor: Imagine trying to find a specific key on a messy desk. If you show the robot the whole messy desk, it gets distracted. TestWeaver clears the desk, leaving only the key and the immediate area around it. This stops the robot from getting confused or "hallucinating" (making up things that aren't there) and helps it focus entirely on the path to the target.

2. The "Almost-There" Trick (Closest Test Case)

Sometimes, the robot tries to get to the door but stops just one step short. TestWeaver looks at the robot's previous attempts and finds the one that got closest to the door.

  • The Metaphor: Imagine the robot tried to climb a ladder but stopped at the third rung. TestWeaver says, "Look, you almost made it! You stopped at rung three. The door is just above rung four. Let's look at exactly where you stopped and figure out how to take that next step." Instead of starting from scratch, it uses the robot's near-miss as a stepping stone to guide the next attempt.

3. The "Live Commentary" Trick (Execution In-lines)

When the robot tries again and fails, TestWeaver doesn't just say, "Try again." It rewrites the instructions with a live commentary. It adds notes right next to the steps, saying things like, "At this moment, the robot is holding a red key," or "The door is locked because the light is off."

  • The Metaphor: It's like watching a video game with a coach shouting out the stats in real-time. Instead of the robot guessing what the game state is, the coach tells it, "You have 50 health points, and the enemy is to your left." This gives the robot a clear picture of what is actually happening inside the code, helping it understand exactly what change is needed to reach the target.

The Results

The authors tested this system on 35 real-world software projects (like a collection of different mansions). They found that:

  • Better Coverage: TestWeaver found more "rooms" (lines of code) than the previous best methods. It covered 68% of the code, while the others only managed 61% and 46%.
  • Faster Success: It reached its peak performance much faster. While other methods got stuck in loops of failure (the plateau) for a long time, TestWeaver kept making progress because its guidance was so specific.
  • Cost Effective: Even though it was smarter, it didn't cost significantly more money to run because it gave the robot smaller, clearer instructions (less "noise" to process).

In short, TestWeaver stops the robot from wandering aimlessly in a giant mansion. Instead, it gives it a focused spotlight, a reference to its best previous attempt, and a live commentary on the path ahead, ensuring it finally finds that specific door it was looking for.

Drowning in papers in your field?

Get daily digests of the most novel papers matching your research keywords — with technical summaries, in your language.

Try Digest →