Datasets:
Upload folder using huggingface_hub
Browse files- README.md +63 -28
- build_dataset.py +15 -22
- data/test.parquet +2 -2
- validate_patches.py +2 -2
README.md
CHANGED
|
@@ -24,8 +24,7 @@ configs:
|
|
| 24 |
|
| 25 |
# TEBench: Project-Level Test Evolution Benchmark
|
| 26 |
|
| 27 |
-
|
| 28 |
-
> the BibTeX authors, and add the harness / Docker links.
|
| 29 |
|
| 30 |
**TEBench** is the first **project-level** benchmark for *test evolution*: given a
|
| 31 |
project repository and a commit that changes production code, a system must
|
|
@@ -53,20 +52,21 @@ A task may carry multiple types simultaneously.
|
|
| 53 |
|
| 54 |
Each instance is built around three versions of the project:
|
| 55 |
|
| 56 |
-
- **V−1** (`
|
| 57 |
- **V−0.5** — V−1 **plus all non-test changes** from the commit (production code,
|
| 58 |
-
build config, resources), with the **original tests untouched**.
|
|
|
|
| 59 |
state given to the system: *the source has moved on, the tests have not.*
|
| 60 |
-
- **V0** (`
|
| 61 |
changes. This is the **ground truth**.
|
| 62 |
|
| 63 |
In this dataset:
|
| 64 |
|
| 65 |
-
- `source_patch` applies to **V−1** and reconstructs **V−0.5** (the
|
| 66 |
- `test_patch` is the **gold answer**: the developer's test changes (V−0.5 → V0).
|
| 67 |
|
| 68 |
Both patches were generated with `git diff --binary --full-index` and are verified
|
| 69 |
-
to apply cleanly to `
|
| 70 |
**314/314 source patches and 314/314 test patches apply.**
|
| 71 |
|
| 72 |
## Data Fields
|
|
@@ -76,14 +76,11 @@ to apply cleanly to `base_commit` with `git apply` (see `validate_patches.py`):
|
|
| 76 |
| `instance_id` | string | Stable id, `<project>__<short_hash>`. |
|
| 77 |
| `project` | string | Project name. |
|
| 78 |
| `repo` | string | Upstream GitHub slug (e.g. `apache/commons-lang`). |
|
| 79 |
-
| `
|
| 80 |
-
| `
|
| 81 |
-
| `
|
| 82 |
-
| `
|
| 83 |
-
| `
|
| 84 |
-
| `difficulty` | string | Curated difficulty label. |
|
| 85 |
-
| `labels` | list[string] | Evolution types: `breaking` / `stale` / `missing`. |
|
| 86 |
-
| `test_change_type` | string | Primary test-change category. |
|
| 87 |
| `changed_test_methods` | list[string] | GT modified/added test methods (`Class.method`). |
|
| 88 |
| `new_test_files` | list[string] | Test files where GT adds new methods. |
|
| 89 |
| `new_test_methods` | string | JSON map `{TestClass: [methods]}` of GT-added methods. |
|
|
@@ -92,7 +89,6 @@ to apply cleanly to `base_commit` with `git apply` (see `validate_patches.py`):
|
|
| 92 |
| `test_changed_lines` | int | Test lines changed. |
|
| 93 |
| `source_patch` | string | **V−1 → V−0.5** diff (non-test; given to the system). |
|
| 94 |
| `test_patch` | string | **V−0.5 → V0** diff (gold test changes). |
|
| 95 |
-
| `label_reasoning` | string | Rationale for the assigned labels. |
|
| 96 |
|
| 97 |
There is a single **`test`** split with 314 instances.
|
| 98 |
|
|
@@ -110,7 +106,7 @@ Reconstruct the agent input (V−0.5) for an instance:
|
|
| 110 |
|
| 111 |
```bash
|
| 112 |
git clone https://github.com/<repo>.git && cd <repo>
|
| 113 |
-
git checkout <
|
| 114 |
git apply source.patch # now at V-0.5: new source, old tests
|
| 115 |
# ... system produces test changes ...
|
| 116 |
git apply test.patch # gold V0 test changes, for reference/eval
|
|
@@ -144,6 +140,14 @@ TEBench evaluates two dimensions (full harness and Docker image referenced below
|
|
| 144 |
| jsoup | 56 | 48 | 42 | 50 |
|
| 145 |
| **Total** | **314** | **172** | **207** | **199** |
|
| 146 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 147 |
- **Multi-label:** 219 tasks (69.7%) carry ≥2 types; 45 (14.3%) carry all three;
|
| 148 |
95 (30.3%) are single-type.
|
| 149 |
- **Complexity (median):** 4 changed files, 34 source lines, ~32 test lines changed.
|
|
@@ -159,14 +163,45 @@ projects**.
|
|
| 159 |
|
| 160 |
## Companion Artifacts
|
| 161 |
|
| 162 |
-
- **Evaluation harness:**
|
| 163 |
-
scoring, baselines.
|
| 164 |
-
- **Reproducible environment:** a Docker image
|
| 165 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 166 |
|
| 167 |
## Licensing
|
| 168 |
|
| 169 |
-
- **Annotations /
|
| 170 |
- **Embedded source code** inside `source_patch` / `test_patch` remains under the
|
| 171 |
**original license of each upstream project** and must be used accordingly:
|
| 172 |
|
|
@@ -174,7 +209,7 @@ projects**.
|
|
| 174 |
|------------|---------|
|
| 175 |
| commons-* (cli, codec, collections, compress, csv, lang, math), gson | Apache-2.0 |
|
| 176 |
| jsoup | MIT |
|
| 177 |
-
| jfreechart | LGPL-2.1
|
| 178 |
|
| 179 |
Attribution to the original authors is preserved through commit hashes and the
|
| 180 |
`repo` field. Redistribution of the Docker image (which contains full source
|
|
@@ -183,10 +218,10 @@ trees) must likewise honor these licenses.
|
|
| 183 |
## Citation
|
| 184 |
|
| 185 |
```bibtex
|
| 186 |
-
@
|
| 187 |
-
title
|
| 188 |
-
|
| 189 |
-
|
| 190 |
-
|
| 191 |
}
|
| 192 |
```
|
|
|
|
| 24 |
|
| 25 |
# TEBench: Project-Level Test Evolution Benchmark
|
| 26 |
|
| 27 |
+
📄 **Paper:** https://arxiv.org/abs/2605.06125 | 💻 **Code:** https://github.com/iSEngLab/TEBench
|
|
|
|
| 28 |
|
| 29 |
**TEBench** is the first **project-level** benchmark for *test evolution*: given a
|
| 30 |
project repository and a commit that changes production code, a system must
|
|
|
|
| 52 |
|
| 53 |
Each instance is built around three versions of the project:
|
| 54 |
|
| 55 |
+
- **V−1** (`v_minus_1_commit`) — parent commit, before any change.
|
| 56 |
- **V−0.5** — V−1 **plus all non-test changes** from the commit (production code,
|
| 57 |
+
build config, resources), with the **original tests untouched**. V−0.5 is *not*
|
| 58 |
+
a commit; it is reconstructed by applying `source_patch` to V−1. This is the
|
| 59 |
state given to the system: *the source has moved on, the tests have not.*
|
| 60 |
+
- **V0** (`v0_commit`) — the full commit including the developer's actual test
|
| 61 |
changes. This is the **ground truth**.
|
| 62 |
|
| 63 |
In this dataset:
|
| 64 |
|
| 65 |
+
- `source_patch` applies to **V−1** and reconstructs **V−0.5** (the system input).
|
| 66 |
- `test_patch` is the **gold answer**: the developer's test changes (V−0.5 → V0).
|
| 67 |
|
| 68 |
Both patches were generated with `git diff --binary --full-index` and are verified
|
| 69 |
+
to apply cleanly to `v_minus_1_commit` with `git apply` (see `validate_patches.py`):
|
| 70 |
**314/314 source patches and 314/314 test patches apply.**
|
| 71 |
|
| 72 |
## Data Fields
|
|
|
|
| 76 |
| `instance_id` | string | Stable id, `<project>__<short_hash>`. |
|
| 77 |
| `project` | string | Project name. |
|
| 78 |
| `repo` | string | Upstream GitHub slug (e.g. `apache/commons-lang`). |
|
| 79 |
+
| `v_minus_1_commit` | string | **V−1** commit hash (parent state, before the change). |
|
| 80 |
+
| `v0_commit` | string | **V0** commit hash (full ground-truth commit). |
|
| 81 |
+
| `v0_date` | string | V0 commit date. |
|
| 82 |
+
| `v0_message` | string | V0 commit message. |
|
| 83 |
+
| `labels` | list[string] | Evolution types: `breaking` / `stale` / `missing` (≥1 per task). |
|
|
|
|
|
|
|
|
|
|
| 84 |
| `changed_test_methods` | list[string] | GT modified/added test methods (`Class.method`). |
|
| 85 |
| `new_test_files` | list[string] | Test files where GT adds new methods. |
|
| 86 |
| `new_test_methods` | string | JSON map `{TestClass: [methods]}` of GT-added methods. |
|
|
|
|
| 89 |
| `test_changed_lines` | int | Test lines changed. |
|
| 90 |
| `source_patch` | string | **V−1 → V−0.5** diff (non-test; given to the system). |
|
| 91 |
| `test_patch` | string | **V−0.5 → V0** diff (gold test changes). |
|
|
|
|
| 92 |
|
| 93 |
There is a single **`test`** split with 314 instances.
|
| 94 |
|
|
|
|
| 106 |
|
| 107 |
```bash
|
| 108 |
git clone https://github.com/<repo>.git && cd <repo>
|
| 109 |
+
git checkout <v_minus_1_commit>
|
| 110 |
git apply source.patch # now at V-0.5: new source, old tests
|
| 111 |
# ... system produces test changes ...
|
| 112 |
git apply test.patch # gold V0 test changes, for reference/eval
|
|
|
|
| 140 |
| jsoup | 56 | 48 | 42 | 50 |
|
| 141 |
| **Total** | **314** | **172** | **207** | **199** |
|
| 142 |
|
| 143 |
+
**Label distribution** (a task may carry several types, so shares do not sum to 100%):
|
| 144 |
+
|
| 145 |
+
| Type | Tasks | Share of 314 |
|
| 146 |
+
|------|------:|-------------:|
|
| 147 |
+
| Breaking | 172 | 54.8% |
|
| 148 |
+
| Stale | 207 | 65.9% |
|
| 149 |
+
| Missing | 199 | 63.4% |
|
| 150 |
+
|
| 151 |
- **Multi-label:** 219 tasks (69.7%) carry ≥2 types; 45 (14.3%) carry all three;
|
| 152 |
95 (30.3%) are single-type.
|
| 153 |
- **Complexity (median):** 4 changed files, 34 source lines, ~32 test lines changed.
|
|
|
|
| 163 |
|
| 164 |
## Companion Artifacts
|
| 165 |
|
| 166 |
+
- **Evaluation harness & code:** https://github.com/iSEngLab/TEBench —
|
| 167 |
+
identification & update scoring, baselines, dataset build scripts.
|
| 168 |
+
- **Reproducible environment:** a prebuilt Docker image, shipped as
|
| 169 |
+
`docker/tebench-env.tar` in this repository (see below).
|
| 170 |
+
|
| 171 |
+
## Docker Environment
|
| 172 |
+
|
| 173 |
+
The Docker image bundles everything needed to run and evaluate TEBench — all 10
|
| 174 |
+
project repositories, Maven 3.6.3, OpenJDK 8 / 11 / 17 (default JDK 8), and the
|
| 175 |
+
evaluated coding agents (Claude Code, Codex CLI, OpenCode CLI) — so you do not
|
| 176 |
+
have to configure per-project toolchains.
|
| 177 |
+
|
| 178 |
+
The image archive (`docker/tebench-env.tar`) is stored in this dataset repo as an
|
| 179 |
+
LFS file. HuggingFace is **not** a container registry, so you download the tar and
|
| 180 |
+
load it locally:
|
| 181 |
+
|
| 182 |
+
```bash
|
| 183 |
+
# 1. Download the image archive from this dataset repo
|
| 184 |
+
hf download iSEngLab/TEBench docker/tebench-env.tar --repo-type=dataset --local-dir .
|
| 185 |
+
|
| 186 |
+
# 2. Load it into your local Docker
|
| 187 |
+
docker load -i docker/tebench-env.tar
|
| 188 |
+
|
| 189 |
+
# 3. Start a container
|
| 190 |
+
docker run --rm -it tebench-env
|
| 191 |
+
|
| 192 |
+
# 4. Inside the container
|
| 193 |
+
cd /root/TestUpdate
|
| 194 |
+
java -version && mvn -version # JDK 8 + Maven 3.6.3
|
| 195 |
+
claude --version && codex --version && opencode --version
|
| 196 |
+
```
|
| 197 |
+
|
| 198 |
+
Switch JDK inside the container via `JAVA_HOME` (`JAVA11_HOME`, `JAVA17_HOME` are
|
| 199 |
+
also available). Agent worktrees are large derived artifacts and are **not**
|
| 200 |
+
bundled; regenerate them inside the container with the harness when needed.
|
| 201 |
|
| 202 |
## Licensing
|
| 203 |
|
| 204 |
+
- **Annotations / patch metadata in this dataset:** CC-BY-4.0.
|
| 205 |
- **Embedded source code** inside `source_patch` / `test_patch` remains under the
|
| 206 |
**original license of each upstream project** and must be used accordingly:
|
| 207 |
|
|
|
|
| 209 |
|------------|---------|
|
| 210 |
| commons-* (cli, codec, collections, compress, csv, lang, math), gson | Apache-2.0 |
|
| 211 |
| jsoup | MIT |
|
| 212 |
+
| jfreechart | LGPL-2.1 |
|
| 213 |
|
| 214 |
Attribution to the original authors is preserved through commit hashes and the
|
| 215 |
`repo` field. Redistribution of the Docker image (which contains full source
|
|
|
|
| 218 |
## Citation
|
| 219 |
|
| 220 |
```bibtex
|
| 221 |
+
@article{tebench,
|
| 222 |
+
title = {TEBench: Benchmarking LLM Agents on Project-Level Test Evolution},
|
| 223 |
+
journal = {arXiv preprint arXiv:2605.06125},
|
| 224 |
+
year = {2026},
|
| 225 |
+
url = {https://arxiv.org/abs/2605.06125}
|
| 226 |
}
|
| 227 |
```
|
build_dataset.py
CHANGED
|
@@ -97,34 +97,31 @@ def load_labels(labels_csv: Path) -> dict:
|
|
| 97 |
labels = [LABEL_MAP[t] for t in to_list(r.get("new_labels")) if t in LABEL_MAP]
|
| 98 |
out[key] = {
|
| 99 |
"labels": labels,
|
| 100 |
-
"label_reasoning": r.get("reasoning", ""),
|
| 101 |
"new_test_methods": r.get("new_test_methods", ""),
|
| 102 |
"new_test_files": to_list(r.get("new_test_files")),
|
| 103 |
}
|
| 104 |
return out
|
| 105 |
|
| 106 |
|
|
|
|
|
|
|
| 107 |
SCHEMA = pa.schema([
|
| 108 |
("instance_id", pa.string()),
|
| 109 |
("project", pa.string()),
|
| 110 |
("repo", pa.string()),
|
| 111 |
-
("
|
| 112 |
-
("
|
| 113 |
-
("
|
| 114 |
-
("
|
| 115 |
-
("
|
| 116 |
-
("difficulty", pa.string()),
|
| 117 |
-
("labels", pa.list_(pa.string())), # breaking / stale / missing
|
| 118 |
-
("test_change_type", pa.string()),
|
| 119 |
("changed_test_methods", pa.list_(pa.string())),
|
| 120 |
("new_test_files", pa.list_(pa.string())),
|
| 121 |
-
("new_test_methods", pa.string()),
|
| 122 |
("num_changed_files", pa.int64()),
|
| 123 |
("src_changed_lines", pa.int64()),
|
| 124 |
("test_changed_lines", pa.int64()),
|
| 125 |
-
("source_patch", pa.string()),
|
| 126 |
-
("test_patch", pa.string()),
|
| 127 |
-
("label_reasoning", pa.string()),
|
| 128 |
])
|
| 129 |
|
| 130 |
|
|
@@ -160,20 +157,17 @@ def main():
|
|
| 160 |
lab = labels.get((project, short))
|
| 161 |
if lab is None:
|
| 162 |
missing_labels += 1
|
| 163 |
-
lab = {"labels": [], "
|
| 164 |
|
| 165 |
records.append({
|
| 166 |
"instance_id": f"{project}__{short}",
|
| 167 |
"project": project,
|
| 168 |
"repo": REPO_SLUG.get(project, project),
|
| 169 |
-
"
|
| 170 |
-
"
|
| 171 |
-
"
|
| 172 |
-
"
|
| 173 |
-
"type": str(row.Type),
|
| 174 |
-
"difficulty": str(row.Difficulty),
|
| 175 |
"labels": lab["labels"],
|
| 176 |
-
"test_change_type": str(row.TestChangeType),
|
| 177 |
"changed_test_methods": to_list(row.ChangedTestMethods),
|
| 178 |
"new_test_files": lab["new_test_files"],
|
| 179 |
"new_test_methods": lab["new_test_methods"],
|
|
@@ -182,7 +176,6 @@ def main():
|
|
| 182 |
"test_changed_lines": int(row.TestChangedLines),
|
| 183 |
"source_patch": src_patch,
|
| 184 |
"test_patch": test_patch,
|
| 185 |
-
"label_reasoning": lab["label_reasoning"],
|
| 186 |
})
|
| 187 |
if i % 50 == 0:
|
| 188 |
print(f" ...{i}/{len(spine)}")
|
|
|
|
| 97 |
labels = [LABEL_MAP[t] for t in to_list(r.get("new_labels")) if t in LABEL_MAP]
|
| 98 |
out[key] = {
|
| 99 |
"labels": labels,
|
|
|
|
| 100 |
"new_test_methods": r.get("new_test_methods", ""),
|
| 101 |
"new_test_files": to_list(r.get("new_test_files")),
|
| 102 |
}
|
| 103 |
return out
|
| 104 |
|
| 105 |
|
| 106 |
+
# Field names follow the paper's version notation (V-1 / V0). V-0.5 is not a
|
| 107 |
+
# commit: it is V-1 with source_patch applied.
|
| 108 |
SCHEMA = pa.schema([
|
| 109 |
("instance_id", pa.string()),
|
| 110 |
("project", pa.string()),
|
| 111 |
("repo", pa.string()),
|
| 112 |
+
("v_minus_1_commit", pa.string()), # V-1: parent state, before the change
|
| 113 |
+
("v0_commit", pa.string()), # V0: full commit incl. GT test changes
|
| 114 |
+
("v0_date", pa.string()),
|
| 115 |
+
("v0_message", pa.string()),
|
| 116 |
+
("labels", pa.list_(pa.string())), # breaking / stale / missing
|
|
|
|
|
|
|
|
|
|
| 117 |
("changed_test_methods", pa.list_(pa.string())),
|
| 118 |
("new_test_files", pa.list_(pa.string())),
|
| 119 |
+
("new_test_methods", pa.string()), # JSON map {TestClass: [methods]}
|
| 120 |
("num_changed_files", pa.int64()),
|
| 121 |
("src_changed_lines", pa.int64()),
|
| 122 |
("test_changed_lines", pa.int64()),
|
| 123 |
+
("source_patch", pa.string()), # V-1 -> V-0.5 (non-test; the system input)
|
| 124 |
+
("test_patch", pa.string()), # V-0.5 -> V0 (gold test changes)
|
|
|
|
| 125 |
])
|
| 126 |
|
| 127 |
|
|
|
|
| 157 |
lab = labels.get((project, short))
|
| 158 |
if lab is None:
|
| 159 |
missing_labels += 1
|
| 160 |
+
lab = {"labels": [], "new_test_methods": "", "new_test_files": []}
|
| 161 |
|
| 162 |
records.append({
|
| 163 |
"instance_id": f"{project}__{short}",
|
| 164 |
"project": project,
|
| 165 |
"repo": REPO_SLUG.get(project, project),
|
| 166 |
+
"v_minus_1_commit": base,
|
| 167 |
+
"v0_commit": full,
|
| 168 |
+
"v0_date": str(row.Date),
|
| 169 |
+
"v0_message": msg,
|
|
|
|
|
|
|
| 170 |
"labels": lab["labels"],
|
|
|
|
| 171 |
"changed_test_methods": to_list(row.ChangedTestMethods),
|
| 172 |
"new_test_files": lab["new_test_files"],
|
| 173 |
"new_test_methods": lab["new_test_methods"],
|
|
|
|
| 176 |
"test_changed_lines": int(row.TestChangedLines),
|
| 177 |
"source_patch": src_patch,
|
| 178 |
"test_patch": test_patch,
|
|
|
|
| 179 |
})
|
| 180 |
if i % 50 == 0:
|
| 181 |
print(f" ...{i}/{len(spine)}")
|
data/test.parquet
CHANGED
|
@@ -1,3 +1,3 @@
|
|
| 1 |
version https://git-lfs.github.com/spec/v1
|
| 2 |
-
oid sha256:
|
| 3 |
-
size
|
|
|
|
| 1 |
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:64eff60fb61779fac101d7063d0970dd4690bb583c7faa0fb3e673e539ddba85
|
| 3 |
+
size 5149425
|
validate_patches.py
CHANGED
|
@@ -1,7 +1,7 @@
|
|
| 1 |
#!/usr/bin/env python3
|
| 2 |
"""Check that every instance's source_patch + test_patch apply cleanly.
|
| 3 |
|
| 4 |
-
For each task we create an isolated detached worktree at ``
|
| 5 |
``source_patch`` (recreating V-0.5), then apply ``test_patch`` (the gold V0 test
|
| 6 |
changes). Failures are reported per instance. Requires the local repos under
|
| 7 |
``defects4j-projects``; only used for verification, not for dataset consumption.
|
|
@@ -48,7 +48,7 @@ def main():
|
|
| 48 |
wt = tempfile.mkdtemp(prefix="teb_wt_")
|
| 49 |
try:
|
| 50 |
subprocess.run(["git", "-C", str(repo), "worktree", "add", "-q",
|
| 51 |
-
"--detach", wt, r["
|
| 52 |
s_ok, s_err = apply_check(wt, r["source_patch"])
|
| 53 |
if s_ok:
|
| 54 |
ok_src += 1
|
|
|
|
| 1 |
#!/usr/bin/env python3
|
| 2 |
"""Check that every instance's source_patch + test_patch apply cleanly.
|
| 3 |
|
| 4 |
+
For each task we create an isolated detached worktree at ``v_minus_1_commit``, apply
|
| 5 |
``source_patch`` (recreating V-0.5), then apply ``test_patch`` (the gold V0 test
|
| 6 |
changes). Failures are reported per instance. Requires the local repos under
|
| 7 |
``defects4j-projects``; only used for verification, not for dataset consumption.
|
|
|
|
| 48 |
wt = tempfile.mkdtemp(prefix="teb_wt_")
|
| 49 |
try:
|
| 50 |
subprocess.run(["git", "-C", str(repo), "worktree", "add", "-q",
|
| 51 |
+
"--detach", wt, r["v_minus_1_commit"]], capture_output=True)
|
| 52 |
s_ok, s_err = apply_check(wt, r["source_patch"])
|
| 53 |
if s_ok:
|
| 54 |
ok_src += 1
|