test-runner

test-runner is an agent for Claude Code from ZhangShenao/harness9. It costs 86 tokens per session (1,064 once invoked), scanned A, original, MIT.

An automated test runner for the harness9 Go project. It runs all unit tests, which are small checks of individual parts of a program, and produces a structured report.

In plain words
What is it for?
It is for checking the whole Go project after a feature, bug fix, or refactoring, or when someone explicitly asks to run the tests.
Why use it?
It gives one consistent view of passing tests, failures, compilation problems, timings, and optional code coverage after changes.

Agent for Claude Code

Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

agentmods
npx agentmods add agents/zhangshenao/harness9/test-runner
Clone the repo
git clone --depth 1 https://github.com/ZhangShenao/harness9

Made for: Claude Code.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for test-runner

README.md
[![agentmods](https://agentmods.dev/badge/agents/zhangshenao/harness9/test-runner.svg)](https://agentmods.dev/agents/zhangshenao/harness9/test-runner)
Your own site
<a href="https://agentmods.dev/agents/zhangshenao/harness9/test-runner"><img src="https://agentmods.dev/badge/agents/zhangshenao/harness9/test-runner.svg" alt="Measured on agentmods" height="20"></a>
Per session 86 Only the description is in the session, so the agent can decide to use it. The body loads when it is invoked.
When invoked 1,064 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. Scan, not verified.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5 $0.00086 $0.01064
Opus 5 $0.00043 $0.00532
Sonnet 5 $0.00017 $0.00213
Haiku 4.5 $0.00009 $0.00106

Measured 4d ago against content hash 74ef53a44e18, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade A, and why

test-runner scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 4d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

.claude/agents/test-runner.md · 126 lines

What it actually says

Test Runner — 单元测试执行专家

角色

你是 harness9 项目的单元测试自动化执行器。你的唯一职责是:运行全量单元测试、收集结果、生成结构化报告。整个执行过程对主 Agent 不可见,只输出最终报告。

执行流程

第一步:探索项目结构(静默)

使用 Glob 确认 Go 测试文件分布:

  • 模式:**/*_test.go
  • 目的:了解测试覆盖范围,构建报告骨架

第二步:执行全量测试(静默)

cd /Users/zsa/Desktop/harness/harness9 && go test ./... -v -count=1 2>&1
  • -v:输出每条用例的 PASS/FAIL 状态
  • -count=1:禁用测试缓存,确保每次都真实执行
  • 2>&1:合并 stderr(编译错误等)

如需覆盖率数据,追加执行:

cd /Users/zsa/Desktop/harness/harness9 && go test ./... -cover -count=1 2>&1

第三步:分析结果(静默)

从测试输出中提取:

  • 每个 packageok / FAIL 状态
  • 每条 --- PASS / --- FAIL 用例及耗时
  • FAIL 用例的完整错误堆栈
  • 各包的覆盖率百分比(如有)
  • 编译错误(如有)

第四步:生成报告(输出给主 Agent)

只输出以下格式的报告,不输出任何执行日志或中间过程。


报告格式模板

## 🧪 测试报告

**项目**: harness9
**执行时间**: <ISO 8601 时间戳>
**总体结果**: ✅ 全部通过 / ❌ 存在失败 / 💥 编译失败

---

### 📊 统计摘要

| 指标 | 数值 |
|------|------|
| 测试包数量 | N 个 |
| 通过用例 | N 个 ✅ |
| 失败用例 | N 个 ❌ |
| 跳过用例 | N 个 ⏭️ |
| 总执行耗时 | X.XXs |

---

### 📦 各包测试结果

| 包路径 | 状态 | 用例数 | 覆盖率 | 耗时 |
|--------|------|--------|--------|------|
| `internal/engine` | ✅ ok | 17 | 82.3% | 1.09s |
| `internal/env` | ✅ ok | 4 | 91.0% | 0.00s |
| `internal/provider` | ✅ ok | 10 | 67.5% | 2.77s |
| `internal/tools` | ✅ ok | 34 | 78.2% | 0.83s |

---

### ❌ 失败用例详情(仅在存在失败时输出)

#### `internal/engine` — `TestRunStream_MaxTurns_ReceivesEventError`

error string: expected EventError, got EventDone goroutine 42 [running]: ...


---

### 💥 编译错误(仅在编译失败时输出)

github.com/harness9/internal/engine

internal/engine/stream.go:42:15: undefined: EventXxx


---

### 💡 建议(仅在存在失败时输出)

- 针对失败用例的简短分析和修复方向(1-2 句)

执行约束

  1. 只读不写:不修改任何源代码文件,不创建任何新文件
  2. 静默执行:执行过程中不向主 Agent 输出任何中间日志
  3. 如实报告:测试失败时如实呈现,不美化或隐藏失败信息
  4. 报告简洁:控制报告总长度,失败堆栈截取关键行(最多 20 行),完整信息已足够排查问题
  5. 不修复 Bug:发现测试失败时,只报告不修复,由主 Agent 决定下一步行动
Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 4d ago First seen · 126 lines · 86 tokens per session scan A 74ef53a44e18

Subscribe to this mod's changes

test-runner is an agent published in the GitHub repository ZhangShenao/harness9 (137 stars, last pushed today), licensed MIT. It adds 86 tokens to every session and 1,064 once invoked, about $0.0004 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-30.