Test

作者 parcadeid07ff4b06b62無授權條款3.9K 個星標收錄於 2026年10月8日更新於 2026年10月8日儲存庫8 個月前更新

Comprehensive testing workflow - unit tests ∥ integration tests → E2E tests

AI 產生的概覽

執行分階段的軟體測試流程:型別診斷、並行的單元與整合測試,接著是端對端測試。

功能
此技能定義了一套測試流程:先進行預檢型別診斷,然後並行執行單元測試、型別檢查與程式碼檢查,以及整合測試與 API 測試,只有在前面階段通過後才執行端對端與驗收測試。它會回報通過/失敗數量與失敗詳情,並可選擇只執行受近期變更影響的測試。它也說明了快速僅單元測試、略過端對端測試、覆蓋率報告與監看模式等旗標。
適用情境
當被要求執行所有測試、測試某項功能、驗證一切是否正常或執行完整測試套件時使用,特別適合在發布或合併之前,以及重大變更之後。
執行需求
僅為說明文件,未附帶指令碼。它需要測試執行器以及 tldr diagnostics 與 change-impact 指令,還需要名為 arbiter 與 atlas 的子代理來執行並行與循序階段。

/test - Testing Workflow

Run comprehensive test suite with parallel execution.

When to Use

  • "Run all tests"
  • "Test the feature"
  • "Verify everything works"
  • "Full test suite"
  • Before releases or merges
  • After major changes

Workflow Overview

┌─────────────┐      ┌───────────┐│ diagnostics │ ──▶  │ arbiter  │ ─┐│ (type check)│      │ (unit)    │  │└─────────────┘      └───────────┘  │                                    ├──▶ ┌─────────┐                     ┌───────────┐  │    │  atlas  │                     │  arbiter  │ ─┘    │ (e2e)   │                     │ (integ)   │       └─────────┘                     └───────────┘
  Pre-flight         Parallel              Sequential  (~1 second)        fast tests            slow tests

Agent Sequence

#AgentRoleExecution
1arbiterUnit tests, type checks, lintingParallel
1arbiterIntegration testsParallel
2atlasE2E/acceptance testsAfter 1 passes

Why This Order?

  1. Fast feedback: Unit tests fail fast
  2. Parallel efficiency: No dependency between unit and integration
  3. E2E gating: Only run slow E2E tests if faster tests pass

Execution

Phase 0: Pre-flight Diagnostics (NEW)

Before running tests, check for type errors - they often cause test failures:

bash
tldr diagnostics . --project --format text 2>/dev/null | grep "^E " | head -10

Why diagnostics first?

  • Type check is instant (~1s), tests take longer
  • Diagnostics show ROOT CAUSE, tests show symptoms
  • "Expected int, got str" is clearer than "AttributeError at line 50"
  • Catches errors in untested code paths

If errors found: Fix them BEFORE running tests. Type errors usually mean tests will fail anyway.

If clean: Proceed to Phase 1.

Phase 0.5: Change Impact (Optional)

For large test suites, find only affected tests:

bash
tldr change-impact --session# or for explicit files:tldr change-impact src/changed_file.py

This returns which tests to run based on what changed. Skip this for small projects or when you want full coverage.

Phase 1: Parallel Tests

# Run both in parallelTask(  subagent_type="arbiter",  prompt="""  Run unit tests for: [SCOPE]
  Include:  - Unit tests  - Type checking  - Linting
  Report: Pass/fail count, failures detail  """,  run_in_background=true)
Task(  subagent_type="arbiter",  prompt="""  Run integration tests for: [SCOPE]
  Include:  - Integration tests  - API tests  - Database tests
  Report: Pass/fail count, failures detail  """,  run_in_background=true)
# Wait for both[Check TaskOutput for both]

Phase 2: E2E Tests (If Phase 1 Passes)

Task(  subagent_type="atlas",  prompt="""  Run E2E tests for: [SCOPE]
  Include:  - End-to-end flows  - Acceptance tests  - UI tests if applicable
  Report: Pass/fail count, screenshots on failure  """)

Test Scopes

Full Suite

User: /test→ All unit + integration + E2E tests

Feature Scope

User: /test authentication→ Only auth-related tests

Quick Check

User: /test --quick→ Only unit tests (skip integration and E2E)

Example

User: /test the new payment feature
Claude: Starting /test workflow for payment feature...
Phase 0: Pre-flight diagnostics...$ tldr diagnostics . --project --format text | grep "^E "(no type errors found)
Phase 1: Running parallel tests...┌─────────────────────────────────────────┐│ arbiter: Running unit tests...          ││ arbiter: Running integration tests...   │└─────────────────────────────────────────┘
arbiter: ✅ 45/45 unit tests passingarbiter: ✅ 12/12 integration tests passing
Phase 2: Running E2E tests...atlas: ✅ 8/8 E2E tests passing
Test Summary:┌─────────────┬─────────┬────────┐│ Type        │ Passed  │ Failed │├─────────────┼─────────┼────────┤│ Unit        │ 45      │ 0      ││ Integration │ 12      │ 0      ││ E2E         │ 8       │ 0      │├─────────────┼─────────┼────────┤│ TOTAL       │ 65      │ 0      │└─────────────┴─────────┴────────┘
All tests passing! ✅

Example with Type Errors

User: /test
Claude: Starting /test workflow...
Phase 0: Pre-flight diagnostics...$ tldr diagnostics . --project --format text | grep "^E "E src/payment.py:45:12: Argument of type 'str' not assignable to 'int'E src/refund.py:23:8: Return type 'None' not assignable to 'float'
Found 2 type errors. Fixing before running tests...
[Claude fixes the type errors]
Re-running diagnostics... clean.
Phase 1: Running parallel tests...

Failure Handling

If Phase 1 fails:

arbiter: ❌ 43/45 tests passing
2 failures:- test_payment_validation: expected 'invalid' got 'valid'- test_refund_calculation: off by $0.01
Stopping workflow. Fix failures before running E2E tests.

Flags

  • --quick: Unit tests only
  • --no-e2e: Skip E2E tests
  • --coverage: Include coverage report
  • --watch: Re-run on file changes

來源與署名

來源:parcadei/continuous-claude-v3位於.claude/skills/test提交d07ff4b

授權條款: 無授權條款

內容歸原作者所有。SourceWeft 從公開儲存庫中收錄這些內容。

檢舉或申請下架