Sakigo commited on
Commit
cd38bcf
·
verified ·
1 Parent(s): 5689187

Introduce SpecEngineeringBench dataset card and logo

Browse files
Files changed (2) hide show
  1. README.md +56 -227
  2. assets/logo.png +3 -0
README.md CHANGED
@@ -1,258 +1,87 @@
1
  ---
 
2
  license: apache-2.0
 
 
 
 
 
 
 
 
 
3
  ---
4
 
 
 
 
5
 
6
- # TestEngineerBench
7
 
8
- 本仓库提供 100 道正式题目,每题包含两个任务,共 200 个任务目录:
9
 
10
- - **Task1**:根据题面编写并运行测试,提交测试代码及题面要求的分类材料。
11
- - **Task2**:主动测试、复现问题并定位缺陷,提交报告及执行证据。
12
 
13
- 交付文件为 [data.tar.gz](https://huggingface.co/datasets/Tokenwave-AI/TestEngineerBench/resolve/main/data.tar.gz?download=true),解压后得到 `portable/`。仓库当前为私有,需要使用有访问权限的 Hugging Face 账号下载。
14
 
15
- **当前评测范围:**可以使用下文入口启动 agent 和独立评测环境。100 道 Task2 已接入自动复现:评分器执行提交的测试、生成核验回执,再按原有六项定位指标评分。缺依赖、超时等执行异常直接报错。本交付未全量重建所有镜像或重跑全部 Oracle。
 
 
 
 
 
 
 
16
 
17
- ## 1. 运行环境
18
 
19
- 准备一台 Linux x86_64 机器,并安装:
 
 
20
 
21
- - Python 3.12。
22
- - Docker Engine、Docker Compose v2,以及支持 additional build contexts 的 BuildKit/Buildx。
23
- - 所选 agent/model 所需的 API 凭据。
24
 
25
- 首次构建需要访问远程 Git 仓库、容器镜像源及各题依赖源。题包不包含预构建镜像,首次启动会现场构建。模型 API 凭据应按所选 agent 的要求配置;Hugging Face 下载 token 不用于模型推理。
26
 
27
- 以下命令在同一个 Bash 终端执行,从 `data.tar.gz` 所在目录开始。若已解压,可跳过解压命令。
28
 
29
  ```bash
30
- tar -xzf data.tar.gz
31
-
32
- python3.12 -m venv .venv
33
- source .venv/bin/activate
34
- python -m pip install 'harbor==0.23.0' 'tomlkit==0.15.1'
35
-
36
- docker info
37
- docker compose version
38
- docker buildx version
39
  ```
40
 
41
- Harbor 固定使用 **0.23.0**。带配套 runtime 的任务会检查版本,安装其他版本会被拒绝。依赖清单也保存在相关任务的 `tests/build/runtime-requirements.txt` 中。
42
-
43
- ## 2. 题包结构
44
-
45
  ```text
46
  portable/
47
- README.md
48
  manifest.json
49
- <repository>/
50
- <episode>/
51
- pr_info.json
52
- task_info.json
53
- validation_info.json
54
- task1/
55
- instruction.md
56
- task.toml
57
- environment/
58
- Dockerfile
59
- .dockerignore
60
- build/
61
- tests/
62
- Dockerfile
63
- .dockerignore
64
- docker-compose.yaml
65
- test.sh
66
- build/
67
- task2/ # 与 task1 相同的目录结构
68
  ```
69
 
70
- - `instruction.md`:模型应遵循的任务说明和提交格式。
71
- - `task.toml`:Harbor 任务配置、时限、网络策略及产物收集配置。
72
- - `environment/build/`:源码重建配方、依赖及其他答题镜像构建输入。
73
- - `tests/build/`:私有评分代码、参考版本重建配方,以及部分任务需要的配套 runtime。
74
- - 三个题目根目录 JSON 保留原始内容;其中的历史验证证据不代表本次重新执行的验证结果。
75
 
76
- 正式范围以 `manifest.json` 中的 `episodes` 为准。下载后通过 **当前 portable 路径 + episode.id** 定位题目;其中 `destination`、`release_root` 是导出时的服务器路径,不应直接作为下载后的本地路径。
77
 
78
- ## 3. 单题启动
 
79
 
80
- 先按所选 agent 的要求配置模型 API 凭据,再指定 agent 和模型。模型标识需要替换为实际可用值:
81
 
82
- ```bash
83
- export AGENT="codex"
84
- export MODEL="替换为实际模型标识"
85
- ```
86
 
87
- 当前有两类启动入口:178 个任务使用普通 Harbor 入口,22 个任务需要题包内的 runtime 启动器。下面的 Bash 函数自动选择正确入口;请在当前终端定义一次:
88
-
89
- ```bash
90
- run_teb() {
91
- local task="${1:?需要提供任务目录}"
92
- shift
93
 
94
- if [ -f "$task/tests/build/run_harbor.py" ]; then
95
- python "$task/tests/build/run_harbor.py" \
96
- --agent "$AGENT" --model "$MODEL" \
97
- --n-attempts 1 --n-concurrent 1 "$@"
98
- else
99
- harbor run --path "$task" \
100
- --agent "$AGENT" --model "$MODEL" \
101
- --n-attempts 1 --n-concurrent 1 "$@"
102
- fi
103
  }
104
  ```
105
-
106
- 例如,运行 Flask 的 Task1:
107
-
108
- ```bash
109
- TASK="$PWD/portable/pallets_flask/episode-0001/task1"
110
- JOBS="$PWD/jobs/flask-task1"
111
-
112
- run_teb "$TASK" --jobs-dir "$JOBS"
113
- ```
114
-
115
- Harbor 负责构建镜像、启动 agent、收集提交、运行独立评测环境,并记录结果。无需先手动运行 `docker build`。
116
-
117
- 更换题目时修改 `TASK`;切换任务时将末尾改为 `task1` 或 `task2`。Task2 使用同一启动入口,复现核验由独立评分器自动完成,详见“Task2 的复现核验”。
118
-
119
- ### 带配套 runtime 的任务
120
-
121
- 例如 nbconvert 的 Task2,需要以下入口,`run_teb` 已自动覆盖该情况:
122
-
123
- ```bash
124
- python "$PWD/portable/jupyter_nbconvert/episode-0001/task2/tests/build/run_harbor.py" \
125
- --agent "$AGENT" --model "$MODEL" \
126
- --n-attempts 1 --n-concurrent 1 \
127
- --jobs-dir "$PWD/jobs/nbconvert-task2"
128
- ```
129
-
130
- 可以先检查该任务的 runtime 完整性和配置:
131
-
132
- ```bash
133
- python "$PWD/portable/jupyter_nbconvert/episode-0001/task2/tests/build/run_harbor.py" \
134
- --check-runtime
135
- ```
136
-
137
- `--check-runtime` 不执行模型推理,也不代表镜像构建或评分已完成。该启动器固定任务路径和隔离环境 provider,不应再传入 `--path` 或 `--env`。它还负责为相关评测器提供 `TEF_AGENT_IMAGE`。
138
-
139
- ## 4. 按正式清单批量启动
140
-
141
- 先完成上一节的依赖安装、凭据配置,并在当前 Bash 终端定义 `run_teb`。建议先跑通单题,再执行批量任务。
142
-
143
- 以下示例按正式清单串行运行全部 **Task1**,为每个任务设置独立的作业目录:
144
-
145
- ```bash
146
- export TASK_KIND="task1"
147
- JOBS_ROOT="$PWD/jobs"
148
-
149
- while IFS= read -r task; do
150
- label="${task#"$PWD/portable/"}"
151
- label="${label//\//__}"
152
- run_teb "$task" --jobs-dir "$JOBS_ROOT/$label" || break
153
- done < <(
154
- python - "$TASK_KIND" <<'PY'
155
- import json
156
- import sys
157
- from pathlib import Path
158
-
159
- root = Path("portable").resolve()
160
- task_kind = sys.argv[1]
161
- if task_kind not in {"task1", "task2"}:
162
- raise SystemExit("TASK_KIND must be task1 or task2")
163
- manifest = json.loads((root / "manifest.json").read_text())
164
- for episode in manifest["episodes"]:
165
- print(root / episode["id"] / task_kind)
166
- PY
167
- )
168
- ```
169
-
170
- 遇到启动或评分错误时,循环停止,便于检查对应日志。将 `TASK_KIND` 改为 `task2` 即可运行 Task2,评分器会自动执行复现核验。
171
-
172
- ## 5. 提交与结果
173
-
174
- 模型在容器内读取 `/workspace/prd.md`,操作 `/workspace/repo`,并按各题 `instruction.md` 提交材料。通常提交目录为 `/workspace/submission/`;具体产物收集路径由 `task.toml` 决定。
175
-
176
- - Task1:提交题面要求的测试代码、数据及分类材料。
177
- - Task2:提交 `report.json`、测试代码和执行证据;报告应包含文件、函数、精确行号及复现信息。
178
-
179
- 结果写入命令指定的 `--jobs-dir`,其中包含作业和 trial 结果、agent 日志、verifier 日志、reward 与产物。可以按文件名查找:
180
-
181
- ```bash
182
- find "$JOBS" -type f \( \
183
- -name 'result.json' -o \
184
- -name 'reward.json' -o \
185
- -name 'reward.txt' -o \
186
- -name 'trial.log' \
187
- \)
188
- ```
189
-
190
- 容器内的评分输出位于 `/logs/verifier/`,评分产物通常位于 `/logs/artifacts/`。Task2 成功评分时会输出 `task2-metrics.json`;其定位指标包括文件、函数和行级的 LR/LP。
191
-
192
- 检查结果时应同时查看 trial 状态、评分日志和指标,不能仅根据进程退出或空提交产生的 reward 判断完整评分已成功。
193
-
194
- ## 6. Task2 的复现核验
195
-
196
- 当前 100 道 Task2 已包含自动核验流程。按上述 Harbor 入口启动即可,无需评测方提前运行外部工具或手工生成回执。若曾运行旧版本,请在使用本版本时重新构建 verifier 镜像,确保其中包含新评分代码。
197
-
198
- 评分器归档整个提交目录,在题目版与修复版源码上分别执行复现脚本(通常为 `repro.sh`),收集 pytest 结果及实际执行的源码行,将测试与报告中的具体发现关联,再生成与本次报告、源码和执行证据绑定的核验回执。只有已确认的发现贡献定位得分;原有六项指标的计算公式保持不变。
199
-
200
- 提交时应在题面规定的提交目录保留 `report.json`、复现脚本及其需要的测试文件。仅在报告中声称已复现不能替代实际执行。测试以无特权用户执行,无法读取私有评分资料;当前自动执行器阻止网络 socket(包括 loopback),复现不应依赖网络服务。
201
-
202
- - **正常执行且证据能够关联到具体发现:**标为 `verified`,进入原有定位评分。
203
- - **正常执行但不足以证明具体发现:**标为 `not_confirmed`,在摘要中标记建议复核,该条目不计入已复现得分。
204
- - **缺依赖、命令启动失败、收集或 setup/teardown 失败、超时等异常:**评分入口以非零退出码结束,保留错误日志,不发布零分或残留 reward 文件。
205
-
206
- 容器内产物位置:
207
-
208
- | 路径 | 内容 |
209
- | --- | --- |
210
- | `/logs/artifacts/task2-reproduction/summary.json` | 核验摘要;执行异常时包含错误信息。 |
211
- | `/logs/artifacts/task2-reproduction/verification.json` | 成功完成后生成的核验回执。 |
212
- | `/logs/artifacts/task2-reproduction/buggy/`、`fixed/` | 各版本的执行命令、日志、pytest 结果、执行行与测试源码证据。 |
213
- | `/logs/artifacts/task2-metrics.json` | 成功评分后生成的六项定位指标。 |
214
- | `/logs/verifier/reward.json`、`reward.txt` | 成功评分后的汇总得分。 |
215
-
216
- 每个版本默认限时 180 秒;需要调整时,在 verifier 容器内设置 `TEB_TASK2_REPRODUCTION_TIMEOUT`(单位为秒)。该变量不是模型 API 配置。
217
-
218
- 原有外部核验接口仍保留,用于已有或人工核验的结果:`--verification` 可指定回执;容器内已有 `/tests/task2-reproduction-verification.json` 时也会继续读取。没有外部回执时自动执行上述流程。回执校验逻辑位于 `tests/build/build_benchmark/reproduction.py`,自动执行器位于同目录的 `task2_runtime/`。
219
-
220
- ## 7. 构建方式与网络
221
-
222
- - 题目源码在构建时从远程按固定提交拉取,应用必要补丁和明确列出的删除项,再校验源码树。
223
- - 构建产物中的题目源码移除 Git 元数据;正式任务的原生测试套件按明确路径清理,保留程序运行需要的测试辅助 API。
224
- - Task1 的私有评测镜像在构建时取得两个参考版本;Task2 的私有评测镜像还会拉取用于复现对照的修复版。题包不携带完整题目仓库或参考仓库压缩包。
225
- - `task.toml` 保留 agent 的 `no-network`、verifier 的 `public` 等阶段策略;构建联网与任务执行阶段的网络策略是不同配置。
226
- - 需要代理时,应将可由 Docker 构建环境访问的代理地址传入相关构建配置。仅在宿主机设置 `HTTPS_PROXY`,不保证容器构建过程能够使用它;宿主机的 `127.0.0.1` 也不能直接当作容器内的代理地址。
227
-
228
- 本交付不包含 `solution/`,不能直接依赖题包内的参考解运行 `--agent oracle`。
229
-
230
- ## 8. 常见问题
231
-
232
- | 现象 | 检查方式 |
233
- | --- | --- |
234
- | Harbor 版本检查失败 | 激活运行环境,确认安装的是 `harbor==0.23.0`。 |
235
- | `TEF_AGENT_IMAGE` 未设置,或尝试拉取 `teb-agent-image-required` | 对带 runtime 的任务使用 `run_teb` 或该任务的 `tests/build/run_harbor.py`。 |
236
- | 找不到 `/tests/...` 或评分模块 | 通过 Harbor 的独立评测容器运行;`tests/test.sh` 不是宿主机启动脚本。 |
237
- | 镜像或依赖下载失败 | 检查 Docker 构建网络、远程源访问及代理配置,查看 build 日志。 |
238
- | 模型鉴权或请求失败 | 检查所选 agent 的 API 凭据、API 地址及模型标识。 |
239
- | Task2 复现执行报错或未产生 reward | 查看 `task2-reproduction/summary.json` 和各版本 `command.log`,确认依赖、执行命令与时限;缺少修复版时重新构建 verifier 镜像。 |
240
- | 下载后找不到服务器绝对路径 | 使用当前 `portable/` 路径与 manifest 中的 `episode.id` 重新拼接任务路径。 |
241
-
242
- ## 9. 已完成的交付检查
243
-
244
- 本版本完成了:
245
-
246
- - 100 道题、200 个任务的统一目录检查。
247
- - 300 个原始题目元数据文件的逐字节一致性检查。
248
- - 500 个源码重建配方的源码树一致性检查(包括新增的 100 份 Task2 修复版配方)。
249
- - 200 份 Compose 配置解析及 400 份 Dockerfile 的本地构建输入检查。
250
- - 50 项单元与容器回归,包括 9 项自动复现容器场景、1 份真实历史模型提交回放,以及评分代码完整性检查。
251
- - 100 份自动执行器副本、200 个原评分模块与 10 份冻结评分配置的一致性检查。
252
-
253
- 以上检查不等于全量镜像构建、全量 agent 运行或全量 Oracle 复测。原始 `validation_info.json` 是历史证据;自动复现已接入评分入口,但尚未逐题全量运行所有镜像或模型提交。
254
-
255
- ## 10. 参考
256
-
257
- - [Harbor 0.23.0](https://github.com/harbor-framework/harbor/tree/v0.23.0)
258
- - [Harbor 启动参数](https://github.com/harbor-framework/docs/blob/main/cli/run.mdx)
 
1
  ---
2
+ pretty_name: SpecEngineeringBench
3
  license: apache-2.0
4
+ language:
5
+ - en
6
+ tags:
7
+ - benchmark
8
+ - code
9
+ - software-engineering
10
+ - software-testing
11
+ size_categories:
12
+ - n<1K
13
  ---
14
 
15
+ <p align="center">
16
+ <img src="https://huggingface.co/datasets/Tokenwave-AI/SpecEngineeringBench/resolve/main/assets/logo.png" width="660" alt="SpecEngineeringBench">
17
+ </p>
18
 
19
+ # SpecEngineeringBench
20
 
21
+ **SpecEngineeringBench** evaluates coding agents as autonomous software test engineers. Each instance starts from a product requirements document (PRD), a prerelease Python repository, and a configured execution environment. Agents decide what to test and where to investigate, without an issue description or a designated target.
22
 
23
+ [Paper](https://tokenwave-ai.github.io/SpecEngineeringBench-Page/assets/paper.pdf) · [Project page and overview video](https://tokenwave-ai.github.io/SpecEngineeringBench-Page/#film) · [GitHub and evaluation toolkit](https://github.com/TokenWave-AI/SpecEngineeringBench)
 
24
 
25
+ ## At a glance
26
 
27
+ | | |
28
+ | --- | --- |
29
+ | Instances | 100 across 78 open-source Python repositories |
30
+ | Application categories | 16 |
31
+ | Recorded defect occurrences | 531, with 4–15 per instance |
32
+ | Task directories | 200, two independent tasks per instance |
33
+ | Agent input | English PRD, prerelease repository snapshot, and a configured Docker environment |
34
+ | Release format | One compressed archive with a manifest and Harbor task packages |
35
 
36
+ ## How an instance works
37
 
38
+ 1. **Read the requirements.** The PRD specifies expected behavior, including boundaries and error handling.
39
+ 2. **Task 1, test authoring.** Submit an executable test suite and testcase metadata. The verifier compares registered outcomes on defective and repaired snapshots.
40
+ 3. **Task 2, defect reporting.** Independently produce a structured defect report with execution evidence and file, function, and line locations.
41
 
42
+ Task 2 starts from the same instance inputs as Task 1 and uses its own test artifacts.
 
 
43
 
44
+ ## Download and layout
45
 
46
+ The dataset is distributed as [data.tar.gz](https://huggingface.co/datasets/Tokenwave-AI/SpecEngineeringBench/resolve/main/data.tar.gz?download=true). Sign in with a Hugging Face account that has access.
47
 
48
  ```bash
49
+ hf auth login
50
+ hf download Tokenwave-AI/SpecEngineeringBench data.tar.gz --repo-type dataset --local-dir ./dataset
51
+ tar -xzf ./dataset/data.tar.gz -C ./dataset
 
 
 
 
 
 
52
  ```
53
 
 
 
 
 
54
  ```text
55
  portable/
 
56
  manifest.json
57
+ <repository>/<episode>/
58
+ task_info.json
59
+ pr_info.json
60
+ validation_info.json
61
+ task1/
62
+ task2/
 
 
 
 
 
 
 
 
 
 
 
 
 
63
  ```
64
 
65
+ The `episodes[].id` field in `portable/manifest.json` identifies each instance relative to the extracted `portable/` directory. Each task includes an instruction file, Harbor configuration, and environment and verifier build files. The release pins Harbor 0.23.0 and expects Linux x86-64, Python 3.12, Docker Compose v2, and BuildKit for container execution.
 
 
 
 
66
 
67
+ ## Scoring
68
 
69
+ - **Task 1.** Head Pass Rate pools results for all registered tests. Fail-to-Pass, Entry Coverage, Change-focused Coverage, and the number of submitted tests are averaged per instance.
70
+ - **Task 2.** Recall and precision are computed per instance at file, function, and hunk granularity. Hunk matching uses a three-line tolerance in defective-snapshot coordinates.
71
 
72
+ The GitHub toolkit downloads this archive and summarizes saved `task1-metrics.json` and `task2-metrics.json` artifacts against the dataset manifest. [Evaluation quickstart](https://github.com/TokenWave-AI/SpecEngineeringBench#quickstart)
73
 
74
+ The dataset card retains the release's Apache 2.0 designation. Upstream repository code remains subject to its original license terms.
 
 
 
75
 
76
+ ## Citation
 
 
 
 
 
77
 
78
+ ```bibtex
79
+ @misc{wang2026specengineeringbench,
80
+ title = {SpecEngineeringBench: Evaluating Coding Agents as Autonomous Software Test Engineers},
81
+ author = {Wang, Xingjian and Wang, Shijian and Liu, Minghao and Zou, Ji and Yang, Zetao
82
+ and Lei, Xinping and Liang, Yiming and Yan, Shen and Zhao, Enduo and Shen, Xiaoyang
83
+ and Xuan, Weihao and Liu, Jiaheng and Zhang, Ge},
84
+ year = {2026},
85
+ url = {https://tokenwave-ai.github.io/SpecEngineeringBench-Page/}
 
86
  }
87
  ```
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
assets/logo.png ADDED

Git LFS Details

  • SHA256: 0e0851c3e80d09df7991ef845f6de0ffec93245340f715dd2dbe26796b8d9dc9
  • Pointer size: 130 Bytes
  • Size of remote file: 99 kB