From zenbu-powers
通用測試工程師 playbook:邊緣案例目錄、測試指令參考、E2E / IT / UT 覆蓋策略。供 test-creator agent 載入。
npx claudepluginhub zenbuapps/zenbu-powers --plugin zenbu-powersThis skill uses the workspace's default tool permissions.
通用測試產出的策略 + 參考手冊。test-creator agent 啟動時必載,用來決定「測什麼、用什麼層級測、怎麼跑」。
Searches, retrieves, and installs Agent Skills from prompts.chat registry using MCP tools like search_skills and get_skill. Activates for finding skills, browsing catalogs, or extending Claude.
Checks Next.js compilation errors using a running Turbopack dev server after code edits. Fixes actionable issues before reporting complete. Replaces `next build`.
Guides code writing, review, and refactoring with Karpathy-inspired rules to avoid overcomplication, ensure simplicity, surgical changes, and verifiable success criteria.
Share bugs, ideas, or general feedback.
通用測試產出的策略 + 參考手冊。test-creator agent 啟動時必載,用來決定「測什麼、用什麼層級測、怎麼跑」。
並非所有變更都需要新增測試。參考下面「不寫測試的判斷」再決定動手。
若此次變更沒有產出任何測試檔案,必須在回覆中明確說明原因:
不得在沒有說明的情況下跳過測試產出。
| 層級 | 關注點 | 典型情境 |
|---|---|---|
| 單元測試(UT) | 邊緣案例 | 負數、null、邊界值、異常輸入、型別錯誤 |
| 整合測試(IT) | 邊緣案例 | Hook/Filter 交互、REST API 驗證、DB 約束、Service 例外、權限邊界 |
| E2E 測試 | 核心業務流程 | 使用者最關鍵操作路徑(購買、註冊、登入),不追求邊緣覆蓋 |
詳細策略見 references/coverage-strategy.md。
掃過 references/edge-case-catalog.md,依照「資料型別 / 並發 / 時間 / 安全 / 國際化」五大類別逐項對照當前功能,篩出適用的案例。
specs/ 所有文件,提取角色、情境、業務規則references/edge-case-catalog.md)測試案例必須依性質分組,分組標籤(建議用 @tag 或 @group):
本地 WordPress 環境(如 LocalWP)比 CI 慢很多,cold start 時 API 回應可能超過 10s。Timeout 設得太短是 flaky test 的頭號元兇。
browser.newContext() 建立的 context 必須明確 context.setDefaultTimeout(60_000),不可依賴 Playwright config 的 actionTimeout(通常只有 10s){ timeout: 30_000 } 以上expect(locator).toBeVisible({ timeout: 10_000 }) 作為最低標準setupApiFromBrowser() 繼承 Playwright config 的 actionTimeout: 10s,在 beforeAll 建立測試資料時很容易超時 → 改用獨立的 setupApiWithLongTimeout() 模式// 正確:獨立 context + 明確 timeout
async function setupApiWithLongTimeout(browser: Browser) {
const context = await browser.newContext({
storageState: STORAGE_STATE_PATH,
ignoreHTTPSErrors: true,
serviceWorkers: 'block',
})
context.setDefaultTimeout(60_000)
// ...
}
// 錯誤:繼承 config 的 10s actionTimeout
const { api } = await setupApiFromBrowser(browser)
| 檔案 | 內容 | 何時讀 |
|---|---|---|
references/edge-case-catalog.md | 邊緣案例目錄(五大類別) | 建立邊緣案例矩陣時 |
references/test-command-reference.md | 各技術棧測試指令範例 | 撰寫 README / SKILL 測試章節時 |
references/coverage-strategy.md | E2E / IT / UT 分工策略 | 決定測試層級分配時 |