File size: 6,475 Bytes
e0b7c28
 
 
b0e2c3c
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1c49f71
b0e2c3c
1c49f71
b0e2c3c
 
 
3d24d1e
 
b0e2c3c
 
 
3d24d1e
 
 
b0e2c3c
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
---
license: cc-by-4.0
task_categories:
  - text-generation
language:
  - en
tags:
  - code
  - java
  - test-generation
  - software-engineering
  - benchmark
size_categories:
  - n<1K
configs:
  - config_name: default
    data_files: data/train.jsonl
---

# TestEvo-Bench / teb-generation

A benchmark for **test-case generation** in evolving Java codebases. Each row captures a single (project, revision-pair) where new tests were authored to exercise newly-added or changed production code, and surfaces both the test code and the surrounding production context needed to predict it.

## Links

- 🌐 Project website: https://www.testevo-bench.com/
- πŸ“¦ Code repository: https://anonymous.4open.science/r/testevo-bench-1150
- 🀝 Sibling dataset: [`TestEvo-Bench/teb-update`](https://huggingface.co/datasets/TestEvo-Bench/teb-update) β€” for **test-update** (modifying existing tests instead of generating new ones)

## Dataset summary

`teb-generation` is a benchmark for generating new test methods that exercise newly-introduced or changed production code. Every example was mined from a real commit (`rev1` β†’ `rev2`) on a public Java project, and the new test is one that depends on the production-code change to behave correctly: it cannot be written or satisfied by reading only the pre-change codebase.

Each row corresponds to a single (project, `rev1` β†’ `rev2`) pair. Inside the row, `test_changes` is a list of one or more individual test methods authored in that commit, each paired with its focal production method, the production-side before/after, candidate dependency methods, and the dependencies that changed in the same commit.

| | |
|---|---|
| Tasks (rows) | 746 |
| Test methods | 1,961 |
| Source projects | 84 distinct Java repositories on GitHub |
| Java versions | 8, 11, 17, 21 |
| Build system | Maven |
| Total size | ~8 MB |

A **task** is one (project, rev1 β†’ rev2) pair β€” the unit a model is asked to operate on. A **test method** is one entry inside that task's `test_changes` list β€” a single `@Test` method that was added or modified at `rev2`. One task may contain several related test methods written together; benchmarks can be reported at either granularity.

## Schema

Each row has the following top-level fields:

| Field | Type | Description |
|---|---|---|
| `task_id` | string | Stable identifier: `<project>__<rev1_short>_<rev2_short>__<test_class>_<hash>` |
| `project_name` | string | e.g. `Javen205_IJPay-v2.8.4` |
| `git_clone_url` | string | Upstream GitHub clone URL |
| `rev1` | string | Git SHA before the change (full 40-char) |
| `rev2` | string | Git SHA after the change |
| `rev1_date` | string | ISO 8601 (e.g. `2019-12-08T06:45:32Z`) |
| `rev2_date` | string | ISO 8601 |
| `git_diff_url` | string | GitHub `compare` URL between rev1 and rev2 |
| `test_file` | string | Path of the test file within the repo |
| `test_changes` | list&lt;struct&gt; | One element per individual test method that was added/changed; see below |
| `version` | string | Upstream tag or branch (e.g. `v2.8.4`, `master`) |
| `java_version` | int | Java major version (8, 11, 17, or 21) |

Each `test_changes[]` element contains:

| Field | Type | Description |
|---|---|---|
| `change_id` | string | Unique id within the dataset |
| `test_sign` | string | JVM-style test method signature |
| `class`, `method`, `module` | string | Test class, method name, Maven module |
| `junit_selector` | string | JUnit selector usable by `mvn test -Dtest=…` |
| `old_test_code` | string \| null | The test method's source at `rev1` (null for newly-added tests) |
| `new_test_code` | string | The test method's source at `rev2` |
| `old_test_lnum`, `new_test_lnum` | list&lt;string&gt; | Line ranges of the test method at each rev |
| `old_test_file_path` | list&lt;string&gt; | Where the test file lived at `rev1` (may be empty for new files) |
| `old_production_code`, `new_production_code` | string | Source of the focal production method at each rev |
| `focal_file_path` | string | Path of the focal production file |
| `focal_method_sign` | string | JVM-style signature of the focal production method |
| `focal_all_deps_scored` | list&lt;struct&gt; | All candidate dependency methods, each with a relevance score (`nc`, `lcs_u`, `ed`, `class`, `tfidf` signal sub-scores combined into `score`) |
| `deps_changes` | list&lt;struct&gt; | Production-code dependencies that changed between `rev1` and `rev2` |

## Example row

```json
{
  "task_id": "Javen205_IJPay-v2.8.4__ceafd24_996582e__WxPayKitTest_8649b344",
  "project_name": "Javen205_IJPay-v2.8.4",
  "git_clone_url": "https://github.com/Javen205/IJPay.git",
  "rev1": "ceafd245bef465d703c7530111626de905893657",
  "rev2": "996582e5028204b7ba2938ccaf009a3715ed204b",
  "rev1_date": "2019-12-08T06:45:32Z",
  "rev2_date": "2019-12-08T07:49:34Z",
  "git_diff_url": "https://github.com/Javen205/IJPay/compare/ceafd24…...996582e…",
  "test_file": "IJPay-WxPay/src/test/java/com/ijpay/wxpay/WxPayKitTest.java",
  "test_changes": [ /* 1 or more entries β€” see Schema */ ],
  "version": "v2.8.4",
  "java_version": 11
}
```

## How to load

```python
from datasets import load_dataset

ds = load_dataset("TestEvo-Bench/teb-generation", split="train")
print(len(ds), ds.column_names)

# Iterate over individual test changes (the unit of evaluation)
for row in ds:
    for tc in row["test_changes"]:
        focal = tc["focal_method_sign"]
        new_test = tc["new_test_code"]
        ...
```

## Source projects + attribution

The code snippets in `old_test_code`, `new_test_code`, `old_production_code`, and `new_production_code` are derived from public Java repositories on GitHub. Each row's `git_clone_url` and `git_diff_url` link back to the upstream project; the upstream repository's own license governs reuse of those code snippets. The dataset structure and metadata are released under CC-BY-4.0 β€” please cite the project (see below) when using this benchmark.

## Intended uses

Evaluating LLMs and program-synthesis systems on the task of generating a new test method given (a) the production-code change, (b) the test file's prior context, and (c) candidate focal-method dependencies. The included `focal_all_deps_scored` signals support both retrieval-augmented and end-to-end setups.

## License

- **Dataset structure and metadata:** CC-BY-4.0
- **Embedded code snippets:** governed by each upstream repository's own license. See `git_clone_url` per row.