Introduce SpecEngineeringBench dataset card and logo
Browse filesFiles changed (2)
- README.md+56-227
- assets/logo.pngAdded
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258---license: apache-2.0---# TestEngineerBench本仓库提供 100 道正式题目,每题包含两个任务,共 200 个任务目录:- **Task1**:根据题面编写并运行测试,提交测试代码及题面要求的分类材料。- **Task2**:主动测试、复现问题并定位缺陷,提交报告及执行证据。交付文件为 [data.tar.gz](https://huggingface.co/datasets/Tokenwave-AI/TestEngineerBench/resolve/main/data.tar.gz?download=true),解压后得到 `portable/`。仓库当前为私有,需要使用有访问权限的 Hugging Face 账号下载。**当前评测范围:**可以使用下文入口启动 agent 和独立评测环境。100 道 Task2 已接入自动复现:评分器执行提交的测试、生成核验回执,再按原有六项定位指标评分。缺依赖、超时等执行异常直接报错。本交付未全量重建所有镜像或重跑全部 Oracle。## 1. 运行环境准备一台 Linux x86_64 机器,并安装:- Python 3.12。- Docker Engine、Docker Compose v2,以及支持 additional build contexts 的 BuildKit/Buildx。- 所选 agent/model 所需的 API 凭据。首次构建需要访问远程 Git 仓库、容器镜像源及各题依赖源。题包不包含预构建镜像,首次启动会现场构建。模型 API 凭据应按所选 agent 的要求配置;Hugging Face 下载 token 不用于模型推理。以下命令在同一个 Bash 终端执行,从 `data.tar.gz` 所在目录开始。若已解压,可跳过解压命令。```bashtar -xzf data.tar.gzpython3.12 -m venv .venvsource .venv/bin/activatepython -m pip install 'harbor==0.23.0' 'tomlkit==0.15.1'docker infodocker compose versiondocker buildx version```Harbor 固定使用 **0.23.0**。带配套 runtime 的任务会检查版本,安装其他版本会被拒绝。依赖清单也保存在相关任务的 `tests/build/runtime-requirements.txt` 中。## 2. 题包结构```textportable/README.mdmanifest.json<repository>/<episode>/pr_info.jsontask_info.jsonvalidation_info.jsontask1/instruction.mdtask.tomlenvironment/Dockerfile.dockerignorebuild/tests/Dockerfile.dockerignoredocker-compose.yamltest.shbuild/task2/ # 与 task1 相同的目录结构```- `instruction.md`:模型应遵循的任务说明和提交格式。- `task.toml`:Harbor 任务配置、时限、网络策略及产物收集配置。- `environment/build/`:源码重建配方、依赖及其他答题镜像构建输入。- `tests/build/`:私有评分代码、参考版本重建配方,以及部分任务需要的配套 runtime。- 三个题目根目录 JSON 保留原始内容;其中的历史验证证据不代表本次重新执行的验证结果。正式范围以 `manifest.json` 中的 `episodes` 为准。下载后通过 **当前 portable 路径 + episode.id** 定位题目;其中 `destination`、`release_root` 是导出时的服务器路径,不应直接作为下载后的本地路径。## 3. 单题启动先按所选 agent 的要求配置模型 API 凭据,再指定 agent 和模型。模型标识需要替换为实际可用值:```bashexport AGENT="codex"export MODEL="替换为实际模型标识"```当前有两类启动入口:178 个任务使用普通 Harbor 入口,22 个任务需要题包内的 runtime 启动器。下面的 Bash 函数自动选择正确入口;请在当前终端定义一次:```bashrun_teb() {local task="${1:?需要提供任务目录}"shiftif [ -f "$task/tests/build/run_harbor.py" ]; thenpython "$task/tests/build/run_harbor.py" \--agent "$AGENT" --model "$MODEL" \--n-attempts 1 --n-concurrent 1 "$@"elseharbor run --path "$task" \--agent "$AGENT" --model "$MODEL" \--n-attempts 1 --n-concurrent 1 "$@"fi}```例如,运行 Flask 的 Task1:```bashTASK="$PWD/portable/pallets_flask/episode-0001/task1"JOBS="$PWD/jobs/flask-task1"run_teb "$TASK" --jobs-dir "$JOBS"```Harbor 负责构建镜像、启动 agent、收集提交、运行独立评测环境,并记录结果。无需先手动运行 `docker build`。更换题目时修改 `TASK`;切换任务时将末尾改为 `task1` 或 `task2`。Task2 使用同一启动入口,复现核验由独立评分器自动完成,详见“Task2 的复现核验”。### 带配套 runtime 的任务例如 nbconvert 的 Task2,需要以下入口,`run_teb` 已自动覆盖该情况:```bashpython "$PWD/portable/jupyter_nbconvert/episode-0001/task2/tests/build/run_harbor.py" \--agent "$AGENT" --model "$MODEL" \--n-attempts 1 --n-concurrent 1 \--jobs-dir "$PWD/jobs/nbconvert-task2"```可以先检查该任务的 runtime 完整性和配置:```bashpython "$PWD/portable/jupyter_nbconvert/episode-0001/task2/tests/build/run_harbor.py" \--check-runtime````--check-runtime` 不执行模型推理,也不代表镜像构建或评分已完成。该启动器固定任务路径和隔离环境 provider,不应再传入 `--path` 或 `--env`。它还负责为相关评测器提供 `TEF_AGENT_IMAGE`。## 4. 按正式清单批量启动先完成上一节的依赖安装、凭据配置,并在当前 Bash 终端定义 `run_teb`。建议先跑通单题,再执行批量任务。以下示例按正式清单串行运行全部 **Task1**,为每个任务设置独立的作业目录:```bashexport TASK_KIND="task1"JOBS_ROOT="$PWD/jobs"while IFS= read -r task; dolabel="${task#"$PWD/portable/"}"label="${label//\//__}"run_teb "$task" --jobs-dir "$JOBS_ROOT/$label" || breakdone < <(python - "$TASK_KIND" <<'PY'import jsonimport sysfrom pathlib import Pathroot = Path("portable").resolve()task_kind = sys.argv[1]if task_kind not in {"task1", "task2"}:raise SystemExit("TASK_KIND must be task1 or task2")manifest = json.loads((root / "manifest.json").read_text())for episode in manifest["episodes"]:print(root / episode["id"] / task_kind)PY)```遇到启动或评分错误时,循环停止,便于检查对应日志。将 `TASK_KIND` 改为 `task2` 即可运行 Task2,评分器会自动执行复现核验。## 5. 提交与结果模型在容器内读取 `/workspace/prd.md`,操作 `/workspace/repo`,并按各题 `instruction.md` 提交材料。通常提交目录为 `/workspace/submission/`;具体产物收集路径由 `task.toml` 决定。- Task1:提交题面要求的测试代码、数据及分类材料。- Task2:提交 `report.json`、测试代码和执行证据;报告应包含文件、函数、精确行号及复现信息。结果写入命令指定的 `--jobs-dir`,其中包含作业和 trial 结果、agent 日志、verifier 日志、reward 与产物。可以按文件名查找:```bashfind "$JOBS" -type f \( \-name 'result.json' -o \-name 'reward.json' -o \-name 'reward.txt' -o \-name 'trial.log' \\)```容器内的评分输出位于 `/logs/verifier/`,评分产物通常位于 `/logs/artifacts/`。Task2 成功评分时会输出 `task2-metrics.json`;其定位指标包括文件、函数和行级的 LR/LP。检查结果时应同时查看 trial 状态、评分日志和指标,不能仅根据进程退出或空提交产生的 reward 判断完整评分已成功。## 6. Task2 的复现核验当前 100 道 Task2 已包含自动核验流程。按上述 Harbor 入口启动即可,无需评测方提前运行外部工具或手工生成回执。若曾运行旧版本,请在使用本版本时重新构建 verifier 镜像,确保其中包含新评分代码。评分器归档整个提交目录,在题目版与修复版源码上分别执行复现脚本(通常为 `repro.sh`),收集 pytest 结果及实际执行的源码行,将测试与报告中的具体发现关联,再生成与本次报告、源码和执行证据绑定的核验回执。只有已确认的发现贡献定位得分;原有六项指标的计算公式保持不变。提交时应在题面规定的提交目录保留 `report.json`、复现脚本及其需要的测试文件。仅在报告中声称已复现不能替代实际执行。测试以无特权用户执行,无法读取私有评分资料;当前自动执行器阻止网络 socket(包括 loopback),复现不应依赖网络服务。- **正常执行且证据能够关联到具体发现:**标为 `verified`,进入原有定位评分。- **正常执行但不足以证明具体发现:**标为 `not_confirmed`,在摘要中标记建议复核,该条目不计入已复现得分。- **缺依赖、命令启动失败、收集或 setup/teardown 失败、超时等异常:**评分入口以非零退出码结束,保留错误日志,不发布零分或残留 reward 文件。容器内产物位置:| 路径 | 内容 || --- | --- || `/logs/artifacts/task2-reproduction/summary.json` | 核验摘要;执行异常时包含错误信息。 || `/logs/artifacts/task2-reproduction/verification.json` | 成功完成后生成的核验回执。 || `/logs/artifacts/task2-reproduction/buggy/`、`fixed/` | 各版本的执行命令、日志、pytest 结果、执行行与测试源码证据。 || `/logs/artifacts/task2-metrics.json` | 成功评分后生成的六项定位指标。 || `/logs/verifier/reward.json`、`reward.txt` | 成功评分后的汇总得分。 |每个版本默认限时 180 秒;需要调整时,在 verifier 容器内设置 `TEB_TASK2_REPRODUCTION_TIMEOUT`(单位为秒)。该变量不是模型 API 配置。原有外部核验接口仍保留,用于已有或人工核验的结果:`--verification` 可指定回执;容器内已有 `/tests/task2-reproduction-verification.json` 时也会继续读取。没有外部回执时自动执行上述流程。回执校验逻辑位于 `tests/build/build_benchmark/reproduction.py`,自动执行器位于同目录的 `task2_runtime/`。## 7. 构建方式与网络- 题目源码在构建时从远程按固定提交拉取,应用必要补丁和明确列出的删除项,再校验源码树。- 构建产物中的题目源码移除 Git 元数据;正式任务的原生测试套件按明确路径清理,保留程序运行需要的测试辅助 API。- Task1 的私有评测镜像在构建时取得两个参考版本;Task2 的私有评测镜像还会拉取用于复现对照的修复版。题包不携带完整题目仓库或参考仓库压缩包。- `task.toml` 保留 agent 的 `no-network`、verifier 的 `public` 等阶段策略;构建联网与任务执行阶段的网络策略是不同配置。- 需要代理时,应将可由 Docker 构建环境访问的代理地址传入相关构建配置。仅在宿主机设置 `HTTPS_PROXY`,不保证容器构建过程能够使用它;宿主机的 `127.0.0.1` 也不能直接当作容器内的代理地址。本交付不包含 `solution/`,不能直接依赖题包内的参考解运行 `--agent oracle`。## 8. 常见问题| 现象 | 检查方式 || --- | --- || Harbor 版本检查失败 | 激活运行环境,确认安装的是 `harbor==0.23.0`。 || `TEF_AGENT_IMAGE` 未设置,或尝试拉取 `teb-agent-image-required` | 对带 runtime 的任务使用 `run_teb` 或该任务的 `tests/build/run_harbor.py`。 || 找不到 `/tests/...` 或评分模块 | 通过 Harbor 的独立评测容器运行;`tests/test.sh` 不是宿主机启动脚本。 || 镜像或依赖下载失败 | 检查 Docker 构建网络、远程源访问及代理配置,查看 build 日志。 || 模型鉴权或请求失败 | 检查所选 agent 的 API 凭据、API 地址及模型标识。 || Task2 复现执行报错或未产生 reward | 查看 `task2-reproduction/summary.json` 和各版本 `command.log`,确认依赖、执行命令与时限;缺少修复版时重新构建 verifier 镜像。 || 下载后找不到服务器绝对路径 | 使用当前 `portable/` 路径与 manifest 中的 `episode.id` 重新拼接任务路径。 |## 9. 已完成的交付检查本版本完成了:- 100 道题、200 个任务的统一目录检查。- 300 个原始题目元数据文件的逐字节一致性检查。- 500 个源码重建配方的源码树一致性检查(包括新增的 100 份 Task2 修复版配方)。- 200 份 Compose 配置解析及 400 份 Dockerfile 的本地构建输入检查。- 50 项单元与容器回归,包括 9 项自动复现容器场景、1 份真实历史模型提交回放,以及评分代码完整性检查。- 100 份自动执行器副本、200 个原评分模块与 10 份冻结评分配置的一致性检查。以上检查不等于全量镜像构建、全量 agent 运行或全量 Oracle 复测。原始 `validation_info.json` 是历史证据;自动复现已接入评分入口,但尚未逐题全量运行所有镜像或模型提交。## 10. 参考- [Harbor 0.23.0](https://github.com/harbor-framework/harbor/tree/v0.23.0)- [Harbor 启动参数](https://github.com/harbor-framework/docs/blob/main/cli/run.mdx)123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687---pretty_name: SpecEngineeringBenchlicense: apache-2.0language:- entags:- benchmark- code- software-engineering- software-testingsize_categories:- n<1K---<p align="center"><img src="https://huggingface.co/datasets/Tokenwave-AI/SpecEngineeringBench/resolve/main/assets/logo.png" width="660" alt="SpecEngineeringBench"></p># SpecEngineeringBench**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.[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)## At a glance| | || --- | --- || Instances | 100 across 78 open-source Python repositories || Application categories | 16 || Recorded defect occurrences | 531, with 4–15 per instance || Task directories | 200, two independent tasks per instance || Agent input | English PRD, prerelease repository snapshot, and a configured Docker environment || Release format | One compressed archive with a manifest and Harbor task packages |## How an instance works1. **Read the requirements.** The PRD specifies expected behavior, including boundaries and error handling.2. **Task 1, test authoring.** Submit an executable test suite and testcase metadata. The verifier compares registered outcomes on defective and repaired snapshots.3. **Task 2, defect reporting.** Independently produce a structured defect report with execution evidence and file, function, and line locations.Task 2 starts from the same instance inputs as Task 1 and uses its own test artifacts.## Download and layoutThe 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.```bashhf auth loginhf download Tokenwave-AI/SpecEngineeringBench data.tar.gz --repo-type dataset --local-dir ./datasettar -xzf ./dataset/data.tar.gz -C ./dataset``````textportable/manifest.json<repository>/<episode>/task_info.jsonpr_info.jsonvalidation_info.jsontask1/task2/```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.## Scoring- **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.- **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.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)The dataset card retains the release's Apache 2.0 designation. Upstream repository code remains subject to its original license terms.## Citation```bibtex@misc{wang2026specengineeringbench,title = {SpecEngineeringBench: Evaluating Coding Agents as Autonomous Software Test Engineers},author = {Wang, Xingjian and Wang, Shijian and Liu, Minghao and Zou, Ji and Yang, Zetaoand Lei, Xinping and Liang, Yiming and Yan, Shen and Zhao, Enduo and Shen, Xiaoyangand Xuan, Weihao and Liu, Jiaheng and Zhang, Ge},year = {2026},url = {https://tokenwave-ai.github.io/SpecEngineeringBench-Page/}}```
README.md+56-227
assets/logo.pngAdded

Large File Pointer Details
- SHA256: 0e0851c3e80d09df7991ef845f6de0ffec93245340f715dd2dbe26796b8d9dc9
- Pointer size: 130 Bytes
- Size of remote file: 99 kB