Community程式設計與開發github.com

提案功能測試計畫

建立一個測試計畫,將EARS需求與關鍵限制系統性地對應到具體的測試項目。

提案功能測試計畫 是什麼?

此技能旨在引導開發者建立一份完整的測試計畫,確保功能規格中的每個需求(REQ-*)與關鍵限制(CC-*)都有對應的驗證測試。它適用於Agents SDK(如Claude Code、Cursor、Codex)的開發流程,在設計文件完成後、實作開始前進行測試規劃。技能提供明確的程序:先驗證必要文件(概念、需求、設計)是否存在,然後從需求與設計文件中提取所有REQ與CC標識符,再根據結構化模板建立 test-plan.md。模板包含需求覆蓋表、關鍵限制驗證方法、整合測試要求(如CLI工具必須測試真實的二進位檔而非內部API),以及「不可測試」與「超出範圍」項目的歸類規則。最後提供驗證命令(如 grep)確保覆蓋率完整,並列出常見錯誤(如類型混淆、描述含糊)。

相容平台~Claude Code~Codex CLI~Cursor
npx skills add https://github.com/cbgbt/bottlerocket-forest/tree/main/skills/propose-feature-test-plan

Installed? Explore more 程式設計與開發 skills: steipete/bluebubbles, steipete/eightctl, steipete/blucli · View all 6 →

在你喜歡的 AI 中提問

開啟一個已預先載入此 Agent Skill 的新對話。

說明文件

提案功能測試計畫技能

目的

建立一份測試計畫,將需求與限制系統性地對應到具體的測試。確保每個需求都有驗證方式,並引導測試實作。

使用時機

  • 設計文件中已有關鍵限制(Critical Constraints)
  • 準備在實作之前規劃測試方法
  • 需要記錄哪些測試將驗證哪個需求

前置條件

  • 功能概念存在於 ./docs/features/NNNN-feature-name/concept.md
  • 需求存在於 ./docs/features/NNNN-feature-name/requirements.md
  • 設計存在於 ./docs/features/NNNN-feature-name/design.md(包含關鍵限制)

程序

1. 驗證前置條件是否存在

ls ./docs/features/NNNN-feature-name/concept.md
ls ./docs/features/NNNN-feature-name/requirements.md
ls ./docs/features/NNNN-feature-name/design.md

若缺少任何檔案,請先完成對應步驟。

2. 提取需求與限制

檢視 requirements.md,找出所有 REQ-* 識別碼。 檢視 design.md,找出所有 CC-* 關鍵限制。

3. 建立測試計畫檔案

建立 ./docs/features/NNNN-feature-name/test-plan.md,結構如下:

# 測試計畫:功能名稱

## 概覽

簡要描述測試方法。

## 測試類型

- **單元測試**:測試隔離的內部邏輯,允許使用模擬(mock)
- **整合測試**:觸碰真實的外部資源(檔案系統、網路),不可使用模擬
- **不可測試**:無法透過自動化測試驗證(說明原因)
- **超出範圍**:需要外部驗證,加以記錄但不必實作

## 需求覆蓋

| 需求 ID | 測試類型 | 測試名稱 | 說明 |
|---------|----------|---------|------|
| REQ-1  | unit      | test_xxx  | 驗證的內容 |
| REQ-2  | integration | test_yyy | 驗證的內容 |
| REQ-3  | not-testable | - | 為何不可測試 |
| REQ-4  | out-of-scope | - | 為何超出範圍 |

## 關鍵限制驗證

| CC ID | 驗證方法 | 測試名稱 |
|-------|---------|----------|
| CC-1  | 限制的驗證方式 | test_xxx |

## 整合測試要求

對於 CLI 程式,整合測試必須:
- 執行使用者實際執行的 CLI 二進位檔/指令
- 不要直接測試內部 API
- 執行使用者/客戶實際會做的操作

## 測試實作註記

針對實作這些測試的具體指引。

4. 對應每個需求

對於 requirements.md 中的每個 REQ-*:

  1. 決定測試類型:

    • 單元測試:內部邏輯、演算法、資料轉換
    • 整合測試:檔案 I/O、網路呼叫、CLI 指令、外部程序
    • 不可測試:無法自動化(例如主觀品質、需要人為判斷、設定不可行)
    • 超出範圍:需要與外部系統進行驗證(雲端 API、需要驗證的註冊表)
  2. 為測試取一個描述性的名稱(例如 test_parses_valid_config)

  3. 撰寫簡短說明,描述它驗證的內容

5. 對應每個關鍵限制

對於 design.md 中的每個 CC-*:

  1. 說明限制將如何驗證
  2. 連結到執行該限制的特定測試名稱
  3. 若限制需要程式碼審查而非自動化測試,請註明

6. 記錄 CLI 測試方法

若功能包含 CLI 指令:

  • 整合測試執行實際的二進位檔
  • 擷取 stdout/stderr 進行驗證
  • 端對端測試真實的使用者工作流程
  • 不要模擬 CLI 層

7. 標記超出範圍的測試

對於需要外部驗證的測試:

  1. 記錄原本要測試的內容
  2. 說明為何超出範圍
  3. 註明任何手動驗證步驟

驗證

# 檢查檔案是否存在
ls ./docs/features/NNNN-feature-name/test-plan.md

# 確認所有需求皆已覆蓋
grep -c "REQ-" ./docs/features/NNNN-feature-name/test-plan.md
grep -c "REQ-" ./docs/features/NNNN-feature-name/requirements.md
# 數量應相當

# 確認所有限制皆已覆蓋
grep -c "CC-" ./docs/features/NNNN-feature-name/test-plan.md
grep -c "CC-" ./docs/features/NNNN-feature-name/design.md
# 數量應相當

常見問題

覆蓋不足:每個 REQ-* 和 CC-* 都必須出現在測試計畫中。使用上述 grep 驗證指令檢查。

測試類型錯誤:單元測試不應觸及檔案系統/網路。整合測試不應使用模擬。

測試內部實作而非行為:對於 CLI 工具,測試使用者執行的 CLI 指令,而非內部函式。

說明含糊:測試說明應明確指出驗證了何種具體行為。

下一步

建立測試計畫後:

  1. 與利害關係人審查覆蓋範圍
  2. 繼續使用「提案實作計畫」技能來規劃實作
  3. 實作計畫應參考 test-plan.md 來取得測試需求

Individual skills in this repo

This repo contains 19 individual skills — each has its own dedicated page.

ad-hoc-implementation-plan

Transform a rough plan into implement-commit ready artifacts. Allows rigorous review while implementing.

build-kit-locally

Build a kit and publish it to a locally hosted registry for development testing

build-variant-from-local-kits

Build a variant using locally published kits for development validation

deep-research

Create educational documents that build understanding progressively with citations

edit-spec-file

Edit Bottlerocket RPM spec files following project style conventions

fact-find

Quick lookup of specific facts about Bottlerocket with citations

idea-honing

Clarify feature ideas through iterative Q&A, recording insights to guide concept development

implement-commit

Implement commits from an implementation plan using a TDD pipeline

local-registry

Start and manage a local OCI registry for Bottlerocket kit development

prepare-core-kit-release

Prepare bottlerocket-core-kit for release by bumping version and updating changelog

propose-feature-concept

Create a new feature concept document to pitch the idea and explain the problem/solution

propose-feature-design

Create or update feature technical design document with architecture and implementation guidance

propose-feature-requirements

Create or update feature requirements specification using EARS notation with examples and appendices

propose-implementation-plan

Create an implementation plan with atomic commits that build toward a complete feature

review-code

Deep code review generating PR comments via principled question-driven analysis

review-scope

Verify code changes match intended scope and requirements without exceeding boundaries

review-style

Verify code follows project style guides without providing improvement suggestions

test-local-twoliter

Build and test local changes to twoliter before releasing

update-twoliter

Update all Bottlerocket repositories to a new Twoliter version

相關技能