---
description: Execute the QA test plan for a feature
argument-hint: <feature-slug>
allowed-tools: Bash, Read, Write, Edit, Glob, Grep, Task
---

Run QA for feature: $ARGUMENTS

## Instructions

### 1. Load Feature and QA Plan

```bash
sdlc feature show $ARGUMENTS --json
```

Read:
- `.sdlc/features/$ARGUMENTS/qa-plan.md` -- the test plan to execute
- `.sdlc/features/$ARGUMENTS/spec.md` -- acceptance criteria to verify

### 2. Execute Unit Tests

Run the project test suite and capture results:

```bash
go test ./... -v 2>&1 | tee /tmp/qa-test-output.txt
```

### 3. Execute Each Test Scenario

Work through every scenario in the QA plan:
- **Happy path scenarios** -- verify expected behavior
- **Edge case scenarios** -- verify boundary handling
- **Error case scenarios** -- verify failure modes

For each scenario, record: scenario ID, status (PASS/FAIL), evidence (test output or manual verification).

### 4. Verify Acceptance Criteria

Cross-reference each acceptance criterion from the spec against test results. Every criterion must have at least one passing test scenario.

### 5. Write QA Results

Write to `.sdlc/features/$ARGUMENTS/qa-results.md`:

```markdown
# QA Results: [Feature Title]

## Test Run Summary
- **Date:** [timestamp]
- **Overall:** PASS / FAIL
- **Scenarios:** N passed, M failed, K skipped

## Scenario Results

### Happy Path
| ID | Scenario | Status | Evidence |
|----|----------|--------|----------|
| HP-1 | [description] | PASS/FAIL | [test name or output] |

### Edge Cases
| ID | Scenario | Status | Evidence |
|----|----------|--------|----------|
| EC-1 | [description] | PASS/FAIL | [evidence] |

### Error Cases
| ID | Scenario | Status | Evidence |
|----|----------|--------|----------|
| ER-1 | [description] | PASS/FAIL | [evidence] |

## Acceptance Criteria Coverage
| Criterion | Scenarios | Status |
|-----------|-----------|--------|
| AC-1 | HP-1, EC-2 | COVERED / GAP |

## Failures (if any)
[Detailed description of each failure with reproduction steps]
```

### 6. Register and Evaluate the Artifact

Create the artifact:

```bash
sdlc artifact create $ARGUMENTS qa_results
```

Then evaluate the QA results and set the appropriate status:

- If **all scenarios pass** and all acceptance criteria are covered: mark as passed
  ```bash
  sdlc artifact pass $ARGUMENTS qa_results
  ```
- If **any scenario fails** or acceptance criteria have gaps: mark as failed
  ```bash
  sdlc artifact fail $ARGUMENTS qa_results
  ```

This status drives the SDLC classifier to either advance to merge or trigger fix-qa-failures.

## Critical Rules

- ALWAYS execute every scenario from the QA plan -- no skipping
- NEVER skip failing tests or mark them as passing without evidence
- ALWAYS document ALL results, including passing scenarios
- ALWAYS verify acceptance criteria coverage explicitly
- NEVER fabricate test evidence -- run the actual tests
- ALWAYS set the artifact status (pass or fail) after writing QA results
