three-tier-testing

A testing structure that separates tests into unit tests, integration tests, and end-to-end tests. Unit tests check isolated code, integration tests check services working together, and end-to-end tests check complete user journeys.

In plain words
What is it for?
Use it to organise test directories, choose the right test layer, configure test commands, and decide which important paths and failure cases need coverage.
Why use it?
It makes test scope and dependencies clear, so a basic test run stays fast while tests needing databases, Docker, browsers, or real services are run deliberately.

Skill for Claude CodeCodex

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 skills/ouob-tw/loopagentteams/three-tier-testing
Any agent
npx skills add ouob-tw/LoopAgentTeams --skill three-tier-testing
Clone the repo
git clone --depth 1 https://github.com/ouob-tw/LoopAgentTeams

Made for: Claude Code, Codex.

Per session 52 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 1,432 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.00052 $0.01432
Opus 5 $0.00026 $0.00716
Sonnet 5 $0.00010 $0.00286
Haiku 4.5 $0.00005 $0.00143

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

Security

Grade A, and why

three-tier-testing 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 3d 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.

three-tier-testing/SKILL.md · 103 lines

How it starts

The opening of the file, as written. The whole thing — 103 lines — stays where its author put it; the contents beside it link to each section on GitHub.

三層測試架構

依照外部依賴程度,將測試分為三層。每層獨立運行,一條指令執行。

層級 目錄 外部依賴 目的
單元測試 tests/unit/ 邏輯正確性 — 純程式碼,所有依賴皆 mock
整合測試 tests/integration/ 假的(測試用 DB 等) 服務串接 — 真實 DB、mock 外部服務
E2E 測試 tests/e2e/ 真的 完整使用者流程 — 無 mock,真實外部服務

前後端分離時,後端測試放 <backend>/tests/ 下,前端測試放 <frontend>/tests/(單元測試可能在 <frontend>/src/**/*.test.*)。單體專案直接用根目錄 tests/

裸跑原則

裸跑測試指令(不帶目錄或標籤參數)只跑單元測試。整合與 E2E 需明確指定。具體實現方式(testpaths、build tag、設定檔分離等)依語言而定,見語言設定章節。

整合測試環境:Host(預設) vs Docker

本機已跑單一 DB?          → Host(預設)
開發流程已有 Docker Compose? → Docker
多資料庫 / 訊息佇列?       → Docker

測試範圍判斷

優先測試:

  • 業務關鍵路徑(付款、認證、資料寫入)
  • 錯誤處理與邊界條件
  • 安全邊界(權限檢查、輸入驗證)
  • 資料完整性(migration、約束、串接)

不需測試:

  • trivial getter/setter、純資料結構
  • 框架自動生成的程式碼(ORM migration 檔、route 註冊)
  • 一次性腳本、設定檔

判斷不了時:問「這段壞了會不會有人被 page」。會 → 測。不會 → 跳過。

測試歸屬判斷

單元測試(tests/unit/

  • 函式邏輯搭配 mock 依賴
  • 資料轉換、驗證、解析
  • 類別行為搭配假協作物件
  • 無 DB fixture、無外部服務

整合測試(tests/integration/

  • 資料庫操作(migration、CRUD、約束)
  • API endpoint 經由 test client 加真實 DB
  • 前端流程搭配 mock backend

E2E 測試(tests/e2e/

  • 瀏覽器驅動的使用者流程 — 無 mock,打真實 server
  • 完整 API 呼叫鏈搭配真實外部服務與真實 API 金鑰
  • 判斷標準:有 mock 就不是 E2E,歸 integration

驗收測試(tests/qa_e2e/,選用)

三層之外的獨立目錄,存放對應規格驗收清單(QA)的測試。LoopAgentTeams 的 qa_executor 依規格逐條撰寫於此。

  • 技術規則同 E2E:無 mock、驅動真實應用
  • tests/e2e/ 分開的原因:每條測試對應規格的一條驗收項,由驗收方撰寫;修正實作的一方(如 test_executor)只能執行、不得修改
  • 裸跑不含此目錄,執行需明確指定(設定方式見語言 reference)
  • 前後端分離時放 <frontend>/tests/qa_e2e/

從扁平 tests/ 遷移

  • 建立 tests/unit/tests/integration/
  • 逐一檢查測試檔:用到真實外部服務 → integration/,純 mock → unit/
  • 拆分共用 fixture:DB fixture → integration/,其餘 → unit/
  • 設定裸跑只執行單元測試(依語言設定)
  • 每層加上自動標記或標籤
  • 執行驗證:裸跑只收集單元測試、指定目錄只收集對應層級

語言設定

依專案檔偵測語言,讀取對應 reference:

偵測檔案 語言 Reference
pyproject.tomlsetup.py Python references/python.md
package.json TypeScript/JavaScript references/typescript.md

多語言專案:各語言子專案分別偵測,各讀各的 reference。

Read the full file on GitHub · 103 lines

Files

What ships with it

2 files beside SKILL.md in the same directory: the scripts, references and assets a skill reads on demand. Not counted in the per-session cost; read them before you install if any of them is executable.

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. 3d ago First seen · 103 lines · 52 tokens per session scan A 7c1801ddd922

Subscribe to this mod's changes

three-tier-testing is a skill published in the GitHub repository ouob-tw/LoopAgentTeams (7 stars, last pushed 21d ago), licensed MIT. It adds 52 tokens to every session and 1,432 once invoked, about $0.0003 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-31.

Related

Other skills, from other repositories

gsd-add-tests

Generate tests for a completed phase based on UAT criteria and implementation.

open-gsd/gsd-core · 18 tokens

specx-tests

Add or refine tests for specx Python services. Use when creating unit tests for use cases/services, integration tests for FastAPI controllers or infrastructure adapters, e2e smoke tests, architecture import guardrails, DI override tests, pytest fixtures, or coverage and boundary checks.

maksimzayats/specx · 58 tokens

test-engineer

Test engineer ensuring quality through unit, integration, and E2E testing strategies.

Vinix24/vnx-orchestration · 19 tokens

test-quality

Use when creating, modifying, reviewing, or deciding whether to add tests, fixtures, mocks, integration tests, end-to-end tests, smoke tests, or test plans in any codebase or language, including regression tests for bug fixes. Chooses the test layer and oracle: guides agents to pick the right test layer, avoid…

hams-ollo/zen-agent-skills · 97 tokens

pre-deploy-qa

Pre-deploy acceptance testing methodology: run test suite (unit/integration/E2E), verify acceptance criteria from user-spec and tech-spec. Does not require live environment. Use when: "приёмочное тестирование", "pre-deploy qa", "проверь перед деплоем", "run tests and check AC", "запусти qa", "проверь acceptance…

stepanenkoviktor0110-boop/ai-dev-methodology-codex · 105 tokens

gsd-add-tests

Generate tests for a completed phase based on UAT criteria and implementation.

shoootyou/get-shit-done-multi · 18 tokens