VCP Test Plan
Generate a comprehensive test plan for a specific file or module.
Step 1: Resolve Config
- Read
.vcp/config.json from the project root. Extract the pluginRoot field.
- If
.vcp/config.json does not exist or pluginRoot is missing: Stop and tell the user: "No VCP configuration found. Run /vcp-init to configure VCP for this project."
- Validate
pluginRoot: The path must be absolute, contain /.claude/ (or \.claude\ on Windows) as a path segment, and contain only safe path characters (letters, digits, /, \, -, _, ., :, and spaces). Reject any path with shell metacharacters (;, &, |, $, `, (, ), {, }, <, >, !, ~, #, *, ?, [, ], ', "). If validation fails, stop and tell the user: "Invalid pluginRoot — must be within ~/.claude/ and contain no shell metacharacters. Run /vcp-init to fix." Also verify the file <pluginRoot>/lib/vcp-context-core.ts exists using Glob. If it does not exist, stop and tell the user: "pluginRoot points to an invalid VCP installation. Run /vcp-init to fix."
- Run the config resolution script via Bash:
bun "<pluginRoot>/lib/resolve-config.ts" "<project-root>"
- Parse the JSON output. It contains:
applicableStandards, ignoredRules, severity, exclude.
Step 2: Fetch Applicable Standards
From the applicableStandards array in the resolved config, keep only entries where:
id is core-testing, OR
id is core-error-handling
For each selected standard, use WebFetch to fetch its content from:
{entry.url}
Extract the Rules section and the Patterns section from each fetched standard.
Step 4: Analyze Target Code
Target path: $ARGUMENTS. If not provided, ask the user which file or module to generate a test plan for.
Read the target code. Read the file(s) at the specified path.
Identify test-relevant elements:
- Entry points — Exported functions, public methods, API endpoints, route handlers, CLI commands
- External dependencies — HTTP clients, database connections, file system access, message queues, third-party SDKs, system clock
- Validation rules — Input validation, type checks, authorization checks, business rule enforcement
- Error conditions — Operations that can fail (network, parsing, I/O), explicit error throws, try/catch blocks
- State transitions — Functions that change state (database writes, cache updates, session changes, queue operations)
Identify the testing framework in use by checking:
package.json for jest, vitest, mocha, ava, etc.
pyproject.toml/setup.cfg for pytest, unittest
go.mod for testing package usage
- Existing test files for import patterns
Step 5: Generate Test Plan
Output a structured test plan following VCP testing standards.
### VCP Test Plan — `[file path]`
**Standards:** core-testing, core-error-handling
**Testing framework:** [detected framework]
#### Summary
- **Entry points:** N functions/methods
- **External dependencies:** [list]
- **Estimated tests:** N unit + M integration + P edge cases
---
#### Mock Guidance
**Mock these** (external boundaries):
- `PaymentGateway.charge()` — External payment API
- `db.query()` — Database connection
- `fetch()` / HTTP client — External API calls
**Do NOT mock these** (internal logic — test through them):
- `PriceCalculator.calculate()` — Internal business logic
- `OrderValidator.validate()` — Internal validation
- `formatCurrency()` — Internal utility
---
#### Unit Tests
##### `createOrder(items, userId)` — line 25
| # | Test Case | Input | Expected Output |
|---|-----------|-------|-----------------|
| 1 | Creates order with valid items | `[{id: 1, qty: 2}], "user-1"` | Order object with correct total |
| 2 | Rejects empty items array | `[], "user-1"` | Throws `ValidationError("items required")` |
| 3 | Rejects negative quantity | `[{id: 1, qty: -1}]` | Throws `ValidationError("quantity must be positive")` |
| 4 | Handles single item | `[{id: 1, qty: 1}]` | Order with total = item price |
| 5 | Handles maximum quantity | `[{id: 1, qty: 999999}]` | Order or appropriate limit error |
##### `processPayment(orderId)` — line 58
...
---
#### Integration Tests
| # | Test Case | Components | What It Verifies |
|---|-----------|------------|------------------|
| 1 | Full order flow | createOrder → processPayment → sendConfirmation | End-to-end order creation with mocked payment gateway |
| 2 | Payment failure rollback | createOrder → processPayment (fails) | Order status reverted, no charge persisted |
---
#### Edge Cases Checklist
- [ ] Null/undefined inputs for each function parameter
- [ ] Empty strings and empty arrays
- [ ] Zero and negative numeric values
- [ ] Boundary values (max int, max string length)
- [ ] Unicode and special characters in string inputs
- [ ] Concurrent access (if applicable)
- [ ] Network timeout on external calls
- [ ] Malformed response from external APIs
- [ ] Database connection failure during transaction
---
#### Error Path Tests
| # | Function | Error Condition | Expected Behavior |
|---|----------|-----------------|-------------------|
| 1 | `processPayment` | Payment gateway returns 500 | Throws `PaymentError`, order unchanged |
| 2 | `processPayment` | Payment gateway timeout | Throws `TimeoutError` after configured limit |
| 3 | `createOrder` | Database write fails | Transaction rolled back, throws `DatabaseError` |
If the target file has no testable functions (e.g., pure configuration, type definitions): "No testable functions found in [path]. This file contains [types/config/constants] and does not require a dedicated test plan."
Converted and distributed by TomeVault — claim your Tome and manage your conversions.
1---2name: z-m-huang-vcp-vcp-test-plan3description: VCP Test Plan4---56# VCP Test Plan78Generate a comprehensive test plan for a specific file or module.910## Step 1: Resolve Config11121. Read `.vcp/config.json` from the project root. Extract the `pluginRoot` field.132. **If `.vcp/config.json` does not exist or `pluginRoot` is missing:** Stop and tell the user: "No VCP configuration found. Run `/vcp-init` to configure VCP for this project."143. **Validate `pluginRoot`:** The path must be absolute, contain `/.claude/` (or `\.claude\` on Windows) as a path segment, and contain only safe path characters (letters, digits, `/`, `\`, `-`, `_`, `.`, `:`, and spaces). Reject any path with shell metacharacters (`;`, `&`, `|`, `$`, `` ` ``, `(`, `)`, `{`, `}`, `<`, `>`, `!`, `~`, `#`, `*`, `?`, `[`, `]`, `'`, `"`). If validation fails, stop and tell the user: "Invalid pluginRoot — must be within ~/.claude/ and contain no shell metacharacters. Run `/vcp-init` to fix." Also verify the file `<pluginRoot>/lib/vcp-context-core.ts` exists using Glob. If it does not exist, stop and tell the user: "pluginRoot points to an invalid VCP installation. Run `/vcp-init` to fix."154. Run the config resolution script via Bash:16 ```bash17 bun "<pluginRoot>/lib/resolve-config.ts" "<project-root>"18 ```195. Parse the JSON output. It contains: `applicableStandards`, `ignoredRules`, `severity`, `exclude`.2021## Step 2: Fetch Applicable Standards2223From the `applicableStandards` array in the resolved config, keep only entries where:24- `id` is `core-testing`, OR25- `id` is `core-error-handling`2627For each selected standard, use WebFetch to fetch its content from:28```29{entry.url}30```3132Extract the **Rules** section and the **Patterns** section from each fetched standard.3334## Step 4: Analyze Target Code3536**Target path:** `$ARGUMENTS`. If not provided, ask the user which file or module to generate a test plan for.37381. **Read the target code.** Read the file(s) at the specified path.39402. **Identify test-relevant elements:**41 - **Entry points** — Exported functions, public methods, API endpoints, route handlers, CLI commands42 - **External dependencies** — HTTP clients, database connections, file system access, message queues, third-party SDKs, system clock43 - **Validation rules** — Input validation, type checks, authorization checks, business rule enforcement44 - **Error conditions** — Operations that can fail (network, parsing, I/O), explicit error throws, try/catch blocks45 - **State transitions** — Functions that change state (database writes, cache updates, session changes, queue operations)46473. **Identify the testing framework** in use by checking:48 - `package.json` for `jest`, `vitest`, `mocha`, `ava`, etc.49 - `pyproject.toml`/`setup.cfg` for `pytest`, `unittest`50 - `go.mod` for `testing` package usage51 - Existing test files for import patterns5253## Step 5: Generate Test Plan5455Output a structured test plan following VCP testing standards.5657```58### VCP Test Plan — `[file path]`5960**Standards:** core-testing, core-error-handling61**Testing framework:** [detected framework]6263#### Summary6465- **Entry points:** N functions/methods66- **External dependencies:** [list]67- **Estimated tests:** N unit + M integration + P edge cases6869---7071#### Mock Guidance7273**Mock these** (external boundaries):74- `PaymentGateway.charge()` — External payment API75- `db.query()` — Database connection76- `fetch()` / HTTP client — External API calls7778**Do NOT mock these** (internal logic — test through them):79- `PriceCalculator.calculate()` — Internal business logic80- `OrderValidator.validate()` — Internal validation81- `formatCurrency()` — Internal utility8283---8485#### Unit Tests8687##### `createOrder(items, userId)` — line 258889| # | Test Case | Input | Expected Output |90|---|-----------|-------|-----------------|91| 1 | Creates order with valid items | `[{id: 1, qty: 2}], "user-1"` | Order object with correct total |92| 2 | Rejects empty items array | `[], "user-1"` | Throws `ValidationError("items required")` |93| 3 | Rejects negative quantity | `[{id: 1, qty: -1}]` | Throws `ValidationError("quantity must be positive")` |94| 4 | Handles single item | `[{id: 1, qty: 1}]` | Order with total = item price |95| 5 | Handles maximum quantity | `[{id: 1, qty: 999999}]` | Order or appropriate limit error |9697##### `processPayment(orderId)` — line 589899...100101---102103#### Integration Tests104105| # | Test Case | Components | What It Verifies |106|---|-----------|------------|------------------|107| 1 | Full order flow | createOrder → processPayment → sendConfirmation | End-to-end order creation with mocked payment gateway |108| 2 | Payment failure rollback | createOrder → processPayment (fails) | Order status reverted, no charge persisted |109110---111112#### Edge Cases Checklist113114- [ ] Null/undefined inputs for each function parameter115- [ ] Empty strings and empty arrays116- [ ] Zero and negative numeric values117- [ ] Boundary values (max int, max string length)118- [ ] Unicode and special characters in string inputs119- [ ] Concurrent access (if applicable)120- [ ] Network timeout on external calls121- [ ] Malformed response from external APIs122- [ ] Database connection failure during transaction123124---125126#### Error Path Tests127128| # | Function | Error Condition | Expected Behavior |129|---|----------|-----------------|-------------------|130| 1 | `processPayment` | Payment gateway returns 500 | Throws `PaymentError`, order unchanged |131| 2 | `processPayment` | Payment gateway timeout | Throws `TimeoutError` after configured limit |132| 3 | `createOrder` | Database write fails | Transaction rolled back, throws `DatabaseError` |133```134135If the target file has no testable functions (e.g., pure configuration, type definitions): **"No testable functions found in [path]. This file contains [types/config/constants] and does not require a dedicated test plan."**136137---138> Converted and distributed by [TomeVault](https://tomevault.io/claim/z-m-huang) — claim your Tome and manage your conversions.139<!-- tomevault:4.0:skill_md:2026-04-16 -->