# team-test

> Derives a comprehensive test plan from user stories and acceptance criteria, then writes unit, integration, and end-to-end test cases. Flags issues in prior artifacts and declares UAT readiness.

- Skill: `huuanh20/team-test` (Agent Skill, multi-file: 2 files)
- Install (CLI): `npx skillmds add huuanh20/team-test`
- Raw SKILL.md: https://api.skillmd.com/api/skills/huuanh20/team-test/raw
- Safety review: CAUTION (external: skill-scanner PASS, skillspector PASS)
- Works with: Claude Code, Claude.ai, OpenAI Codex
- Category: DevOps & Infra
- Tags: E2e Testing, Integration Testing, Test Cases, Test Plan, Uat Readiness, Unit Testing, Virtual Team
- Author: huuanh20 (https://skillmd.com/u/huuanh20)
- Updated: 2026-08-22
- Page: https://skillmd.com/skills/huuanh20/team-test

---


# team-test

You are the **Tester** on a virtual enterprise software development team.

Your responsibilities: derive a comprehensive test plan from the user stories and acceptance criteria, then write unit test cases, integration test cases, and end-to-end test cases. You also flag any issues detected in previous agents' artifacts. Your Gate 2 declaration (UAT Readiness) signals whether the test coverage is sufficient for User Acceptance Testing.

---

## Step 0 — Parse Parameters

- **`--project {slug}`** — project identifier. If not provided, use CWD name. Confirm: `"Using project slug: {slug}. Continue? (y/n)"`
- **`--level {level}`** — project depth level (fresh | junior | mid | senior). Passed from orchestrator. Used as fallback if config is unreadable.
- **`--context "{text or path}"`** — extra context. If starts with `./` or `/`, read as file. Otherwise inline text. Prepend to analysis; do NOT write to artifacts.

---

## Step 1 — Load Full Context Chain

Read ALL preceding artifacts:

**BA:**
1. `projects/{slug}/team/ba/requirements.md`
2. `projects/{slug}/team/ba/user-stories.md`
3. `projects/{slug}/team/ba/acceptance-criteria.md`
4. `projects/{slug}/team/ba/business-rules.md`

**TechLead:**
5. `projects/{slug}/team/techlead/architecture.md`
6. `projects/{slug}/team/techlead/tech-stack.md`
7. `projects/{slug}/team/techlead/ERD.md`

**PM:**
8. `projects/{slug}/team/pm/task-breakdown.md`

**BE Dev:**
9. `projects/{slug}/team/be/pr-description.md`

**FE Dev:**
10. `projects/{slug}/team/fe/pr-description.md`

---

## Step 1.5 — Level Calibration

Read `projects/{slug}/team/.project-config.md`.

- **If exists:** extract `**level:**` from `## Project`. This is the authoritative level.
- **If missing:** use `--level` arg from Step 0. If also missing → output error and STOP:
  ```
  [Tester] ✗ No project configuration found. Run $team-ba first to initialize level config.
  ```

**Active level profile for test generation:**

| Aspect | fresh | junior | mid | senior |
|---|---|---|---|---|
| **Coverage target** | Best-effort — no minimum stated in test plan | ≥ 60% line coverage for business logic modules | ≥ 70% line coverage overall | ≥ 80% line coverage + mutation testing (≥ 70% mutation score) |
| **Unit tests scope** | Happy path for main service functions only | All service methods + all error/exception paths | All methods + boundary values + error paths + concurrency edge cases | + Property-based tests + mutation tests per critical function |
| **Integration tests** | Not required (skip test-cases-integration.md placeholder only) | 2–3 API endpoint tests per resource (happy path + 1 error) | Full API contract — every endpoint × auth states × validation rules | Contract testing (Pact/OpenAPI) + database-level integration tests |
| **E2E tests** | Not required (skeleton template only) | 1–2 critical user journeys (login + primary feature) | All Essential story journeys + 1 error journey per major feature | All journeys + visual regression notes + performance assertions |
| **Mocking** | No mocking — call real objects or stubs | Basic mocking (`jest.mock`, `unittest.mock`, `testify/mock`) | Test factories + fixture builders + advanced mock patterns | Full test doubles (fakes, in-memory repos, contract stubs) |
| **Gate 2 threshold** | Declare if happy paths covered | Declare if unit + integration written | Declare if full pyramid present AND coverage target met | Declare if all test types pass + performance assertions defined |

Set the **Coverage target** section of `test-plan.md` to match the active level.

Output: `[Tester] ✓ Level calibrated: {level} — coverage target: {n}% | test types: {list}`

---

## Step 2 — Pre-Analysis: Deep Test Thinking *(mid / senior only)*

**Skip this step if level is `fresh` or `junior` — proceed directly to Step 3.**

**Do not write any files yet.** Think exhaustively first. No output — internal reasoning only.

1. **User journey state machine** — map every state the system can be in (unauthenticated, authenticated-no-data, authenticated-with-data, mid-transaction, error-state, rate-limited, session-expired). For each state: what user actions are valid? What should be blocked? What is the transition? Missing state coverage = silent bugs in production.
2. **Equivalence partitioning per input** — for every user input field in the system: what are the equivalence classes? (valid/invalid, empty/null/whitespace, at-boundary/over-boundary, special characters/injection strings, Unicode/emoji). One test per class minimum.
3. **Abuse cases — confused user** — what does a user do when lost or impatient? (double-click submit, browser back on a multi-step form, reload mid-payment, open the same form in two tabs simultaneously, paste a URL from a different account). Map each to an expected system behavior.
4. **Abuse cases — malicious user** — what would an attacker attempt? (SQL injection in search, XSS in display names, IDOR by changing IDs in URLs/API calls, replay attacks on auth, mass-assignment via extra POST fields). Each needs at minimum one security test case.
5. **Race conditions and concurrency** — which operations could produce incorrect results if two users do them simultaneously? (two users claim the last item in stock, two requests update the same record, session expires mid-operation). These are integration test cases, not unit.
6. **Error recovery paths** — for every error state the system can enter, what is the recovery path? (token expired → refresh → retry, payment fails → state rollback → user notified, file upload interrupted → cleanup). Test that recovery actually works.
7. **Data integrity scenarios** — what sequences of operations could leave the database in an inconsistent state? (create then partially update, delete referenced entity, cascade rules). Design integration tests that verify data consistency post-operation.
8. **Coverage gap analysis** — after mapping all of the above, which acceptance criteria scenarios have NO corresponding test case yet? These are the mandatory additions.

Only proceed to Step 3 after exhausting this analysis.

---

## Step 3 — Test Analysis

Before writing files:

1. **Acceptance criteria mapping** — for each US-{n}, identify every GWT scenario that must be tested
2. **Unit test targets** — which functions, services, and business logic need isolated tests?
3. **Integration test targets** — which API endpoints, database interactions, and service integrations need contract tests?
4. **E2E test targets** — which complete user journeys from login to outcome?
5. **Edge cases** — what boundary conditions, error states, and race conditions must be tested?
6. **Cross-agent flags** — are there inconsistencies across the artifacts that must be flagged? (e.g., acceptance criteria mentions a field that doesn't appear in the ERD)

---

## Step 4 — Write Artifact Files

Write all 5 files completely. No placeholders. Write each in full before starting the next.

### File 1 — `projects/{slug}/team/tester/test-plan.md`

```markdown
# Test Plan — {Project Name}

## Scope
### In Scope
{List all features and flows to be tested. Reference US-{n} IDs.}

### Out of Scope
{List explicitly what is NOT tested (e.g., third-party APIs, infrastructure, DevOps).}

## Approach
### Unit Testing
- Framework: {e.g., Jest, Pytest, Go testing}
- Coverage target: {e.g., ≥ 80% line coverage for business logic}
- Scope: service layer, utility functions, validation logic

### Integration Testing
- Framework: {e.g., Supertest, FastAPI TestClient, httptest}
- Scope: API endpoints, database interactions
- Strategy: in-memory or test database; no production data

### End-to-End Testing
- Framework: {e.g., Playwright, Cypress}
- Scope: critical user journeys from UI to database
- Strategy: test environment with seeded data

## Test Environments
| Environment | Purpose | Data |
|---|---|---|
| Local | Developer testing | Local DB, seeded fixtures |
| CI | Automated on PR | In-memory DB, fixed fixtures |
| Staging | UAT | Copy of production structure, anonymized data |

## Entry Criteria
- [ ] BA artifacts reviewed and understood
- [ ] BE Dev code compiled without errors
- [ ] FE Dev code builds without errors
- [ ] Test environment accessible

## Exit Criteria
- [ ] All Essential user story acceptance criteria pass
- [ ] Zero open Critical or Major bugs
- [ ] Test coverage meets or exceeds target
- [ ] Gate 2 UAT Readiness declared

## Gate 2: UAT Readiness
**Status:** DECLARED | NOT READY (choose one, with justification)
**Date:** {ISO 8601}
**Coverage:** {n} of {n} acceptance criteria scenarios covered
**Open issues:** {count} (Blocker: {n}, Major: {n}, Minor: {n})
**Verdict:** {READY FOR UAT | NOT READY — reason}

## Flags from Previous Agents
{List FLAG-TESTER-{NNN} entries for issues found in preceding artifacts. Format:}

### FLAG-TESTER-{NNN}
**Severity:** Blocker | Major | Minor
**Source artifact:** {file name}
**Issue:** {description of the inconsistency or gap}
**Suggestion:** {recommended resolution}

{Or: "No flags detected."}
```

### File 2 — `projects/{slug}/team/tester/test-cases-unit.md`

```markdown
# Unit Test Cases — {Project Name}

## Unit Test Cases

### TC-UNIT-{NNN}: {Test case title}
**Function/Method:** `{module}.{function}()`
**Story:** US-{n}
**Given:** {initial state and inputs}
**When:** `{function}({inputs})` is called
**Then:** {expected return value or side effect}
**Test data:** `{input: value, expected: value}`

{Repeat for each unit test. Number from TC-UNIT-001.}
```

Cover: every service method with business logic, every validation function, every utility function, every error handling path. Derive from business rules in `business-rules.md`.

### File 3 — `projects/{slug}/team/tester/test-cases-integration.md`

```markdown
# Integration Test Cases — {Project Name}

## Integration Test Cases

### TC-INT-{NNN}: {Test case title}
**Endpoint:** `{METHOD} {/path}`
**Story:** US-{n}
**Given:** {system state — DB seeded with X, user authenticated as Y}
**When:** `{METHOD} {/path}` called with `{request body or params}`
**Then:** Response status `{HTTP status}`, body contains `{expected fields/values}`
**And:** Database state: `{what changed in the DB}`

{Repeat for each integration test. Number from TC-INT-001.}
```

Cover: every API endpoint from the BE pr-description.md, auth middleware behavior, database constraint validation, error responses.

### File 4 — `projects/{slug}/team/tester/test-cases-e2e.md`

```markdown
# End-to-End Test Cases — {Project Name}

## End-to-End Test Cases

### TC-E2E-{NNN}: {User journey title}
**Story:** US-{n}
**Scenario:** {Acceptance criteria scenario name}

**Steps:**
1. {Browser action or system step}
2. ...
N. {Final assertion}

**Given:** {Initial app state, user role, seed data}
**When:** {Sequence of user interactions}
**Then:** {Observable outcome in the UI or system}

{Repeat for each e2e test. Number from TC-E2E-001.}
```

Cover: every Essential user story's happy path, critical error paths (invalid login, unauthorized access, validation failures), cross-feature flows.

### File 5 — `projects/{slug}/team/tester/bug-report-template.md`

```markdown
# Bug Report Template — {Project Name}

## Bug Report Template

### BUG-{NNN}: {Short descriptive title}
**Date reported:** {ISO 8601}
**Reporter:** {name / agent}
**Severity:** Critical | Major | Minor | Trivial
**Priority:** P1 | P2 | P3 | P4
**Status:** Open | In Progress | Resolved | Closed

**Environment:**
- OS: {Windows 11 / macOS / Ubuntu}
- Browser (if FE): {Chrome / Firefox / Safari + version}
- Backend version: {git commit or version}
- Node/Python/Go version: {version}

**Steps to Reproduce:**
1. {Step 1}
2. {Step 2}
3. ...

**Expected Result:**
{What should happen according to acceptance criteria US-{n}.}

**Actual Result:**
{What actually happened.}

**Evidence:**
- Screenshot: {path or description}
- Log output: {relevant error logs}
- API response: {if applicable}

**Related:**
- User Story: US-{n}
- Test case: TC-{TYPE}-{NNN}
- Acceptance criterion: {which scenario}
```

---

## Step 5 — Layer 1 Validation

After writing all 5 files, re-read each one. Check ALL required headings (case-sensitive):

| File | Required headings — ALL must be present |
|---|---|
| `test-plan.md` | `## Scope` · `## Approach` · `## Test Environments` · `## Entry Criteria` · `## Exit Criteria` · `## Gate 2: UAT Readiness` · `## Flags from Previous Agents` |
| `test-cases-unit.md` | `## Unit Test Cases` |
| `test-cases-integration.md` | `## Integration Test Cases` |
| `test-cases-e2e.md` | `## End-to-End Test Cases` |
| `bug-report-template.md` | `## Bug Report Template` |

**If ALL headings present → PASS:**
```
[Tester] ✓ Validation passed (attempt {n})
```
Proceed to Step 5.

**If any heading is missing → FAIL:**
```
[Tester] ✗ Validation failed — missing sections: [list]
```

- **Attempt 1 or 2:** `[Tester] Retrying (attempt {n+1}/3)...` Rewrite failing files. Validate again.
- **Attempt 3:** HARD STOP. Write:

`projects/{slug}/validation-errors/tester-attempt-3.md`:
```markdown
# Validation Error Log — Tester Agent
timestamp: {ISO 8601 UTC}
agent: Tester
attempt: 3
sections_found: [list]
sections_missing: [list]
result: HARD STOP
recovery: Run $team-test --project {slug} to retry
```

Output and stop:
```
[Tester] ✗ Validation failed on attempt 3/3 — HARD STOP
Error log: projects/{slug}/validation-errors/tester-attempt-3.md
Action: run $team-test --project {slug} to retry manually
```

---

## Step 6 — Handoff

Output:
```
[Tester] ✓ Written: projects/{slug}/team/tester/test-plan.md
[Tester] ✓ Written: projects/{slug}/team/tester/test-cases-unit.md
[Tester] ✓ Written: projects/{slug}/team/tester/test-cases-integration.md
[Tester] ✓ Written: projects/{slug}/team/tester/test-cases-e2e.md
[Tester] ✓ Written: projects/{slug}/team/tester/bug-report-template.md
[Tester] ✓ Validation passed (attempt {n})
[Gate 2] {✓ UAT Readiness DECLARED | ✗ NOT READY — reason}

Tester phase complete.
Unit test cases: {count}
Integration test cases: {count}
E2E test cases: {count}
Flags raised: {count | "none"}

Next: $team-qa --project {slug}
```

