# Test Runner CSV Authoring Instructions (for AI Agents)

> Specification for generating CSV test suites compatible with [Online Web Toolkit Test Runner](https://online-web-toolkit.com/tools/test-runner).

- **Tool URL:** `https://online-web-toolkit.com/tools/test-runner`
- **Instructions URL:** `https://online-web-toolkit.com/test-runner-instructions.md`
- **Sample CSV URL:** `https://online-web-toolkit.com/samples/markdown-to-pdf-test-cases.csv`

When asked to write or update test cases for **Test Runner**, output valid RFC 4180 CSV text (not a Markdown table unless requested) that conforms to the 13-column schema below.

---

## 1. Canonical CSV Header Row

Use this exact header row when generating a new suite:

```csv
Test ID,Suite,Title,Priority,Type,Status,Preconditions,Steps,Expected Result,Actual Result,Duration (s),Owner,Environment
```

Every row MUST contain all 13 columns in the exact header order. Leave unknown values empty (`""` or adjacent commas `,,`) rather than omitting columns. Extra columns beyond the 13 canonical headers are preserved and displayed in the **Case details** inspector drawer, but are omitted from quick-edit forms.

---

## 2. Column Specification & Accepted Header Aliases

Test Runner auto-detects columns case-insensitively. A CSV activates Test Runner analytics when at least one `Status` column is matched OR at least two core semantic columns (`Status`, `Suite`, `Title`, `Priority`, `Steps`, `Expected`) are matched.

| Canonical Header  | Required    | Accepted Header Names / Patterns                                              | Expected Content & Defaults                                                                                       |
| :---------------- | :---------- | :---------------------------------------------------------------------------- | :---------------------------------------------------------------------------------------------------------------- |
| `Test ID`         | Recommended | `Test ID`, `TC ID`, `Case ID`, `ID`, `Key` (or contains `test id`)            | Sequential IDs like `TC-001`, `TC-002`. Defaults to `ROW-<n>`.                                                    |
| `Suite`           | Recommended | `Suite`, `Module`, `Feature`, `Epic`, `Component`, `Section`, `Area`, `Group` | Feature/group name (grouped in Dashboard & Suite Runner). Defaults to `General`.                                  |
| `Title`           | Required    | `Title`, `Name`, `Test Case`, `Case Name`, `Summary`, `Scenario`              | Short, specific test case title. Falls back to `Test ID` or `Case <n>`.                                           |
| `Priority`        | Recommended | `Priority`, `Severity`, `Prio`, `Sev`                                         | Use `Critical`, `High`, `Medium`, or `Low`. Defaults to `Unspecified`.                                            |
| `Type`            | Optional    | `Type`, `Test Type`, `Category`, `Kind`                                       | E.g. `Functional`, `Edge Case`, `UI / Visual`, `Accessibility`, `Security`, `Performance`. Defaults to `General`. |
| `Status`          | Recommended | `Status`, `Result`, `Outcome`, `State`, `Test Status`                         | Use canonical values below. Use `In Progress` for unexecuted plans ready to run.                                  |
| `Preconditions`   | Optional    | Contains `precondition` or `setup`                                            | Required app state, fixtures, auth role, or viewport before step 1.                                               |
| `Steps`           | Recommended | `Steps`, `Test Steps`, `Procedure`, `Actions` (or contains `steps`)           | Numbered steps (`1. ... 2. ...`) or newline-separated lines. See Section 4.                                       |
| `Expected Result` | Recommended | Contains `expected`                                                           | Observable pass criteria checked by the QA runner.                                                                |
| `Actual Result`   | Optional    | Contains `actual`, `notes`, `comment`, or `observation`                       | Observed result/bug notes; leave empty for new unexecuted suites, or explain failures/blockers.                   |
| `Duration (s)`    | Optional    | Contains `duration`, `elapsed`, `latency`, or `time`                          | Numeric seconds only (e.g. `2.4` or `12`, optional trailing `s`). Blank if unmeasured.                            |
| `Owner`           | Optional    | `Owner`, `Assignee`, `Author`, `Tester`, `QA`, `Engineer`                     | Person or team role (e.g. `QA`, `Frontend`). Defaults to `Unassigned`.                                            |
| `Environment`     | Optional    | `Environment`, `Env`, `Browser`, `Platform`, `Device`, `OS`                   | Target runtime (e.g. `Chrome 134 / macOS`, `Safari 18 / iOS`).                                                    |

---

## 3. Allowed Enum Values

### Status Values

Prefer exact title-case values:

- **`In Progress`** (default for new test plans ready to execute in Suite Runner)
- **`Passed`**
- **`Failed`** (automatically surfaced in Dashboard failure triage)
- **`Blocked`** (automatically surfaced in Dashboard failure triage)
- **`Skipped`**

Other recognized status aliases (case-insensitive):

- Normalized to `passed`: `pass`, `passed`, `ok`, `success`, `succeeded`, `green`, `verified`, `done`
- Normalized to `failed`: `fail`, `failed`, `failure`, `error`, `broken`, `bug`, `red`, `rejected`
- Normalized to `blocked`: `block`, `blocked`, `halted`, `stuck`, `on hold`
- Normalized to `in-progress`: `in progress`, `in-progress`, `in_progress`, `inprogress`, `running`, `active`, `wip`, `pending`, `retest`, `in review`, `in-review`
- Normalized to `skipped`: `skip`, `skipped`, `deferred`, `ignored`, `n/a`, `na`, `todo`, `not run`

### Priority Values

Prefer exact title-case values:

- **`Critical`** (also matches `crit`, `p0`, `sev0`, `sev1`, `blocker`, `urgent`)
- **`High`** (also matches `p1`, `sev2`, `major`)
- **`Medium`** (also matches `med`, `mid`, `p2`, `sev3`, `normal`)
- **`Low`** (also matches `p3`, `p4`, `sev4`, `minor`, `trivial`)

---

## 4. Formatting `Steps` for Interactive Checklists

Suite Runner parses the `Steps` cell into checkable step items using two supported formats:

1. **Inline numbered steps (recommended for single-line CSV rows):**
   ```text
   "1. Open /checkout with 2 items in cart. 2. Enter expired promo code. 3. Click Apply."
   ```
   Split boundary: whitespace followed by `<number>. `. Keep sub-numbers like version strings (`v2.1`) without `<digit>. ` spacing.
2. **Newline-separated steps (quoted cell):**
   ```text
   "1. Open /checkout
   2. Enter expired promo code
   3. Click Apply"
   ```

---

## 5. CSV Encoding & Validation Rules

1. **Delimiter:** Use comma (`,`). Auto-detection also supports `;`, tab (`\t`), and `|`, chosen from the first 12 non-empty lines.
2. **RFC 4180 quoting:** Wrap any field containing commas, double quotes, or line breaks in double quotes `"..."`. Escape literal double quotes inside quoted text as `""`.
3. **Zero structural warnings:** Every row must have the exact same column count as the header row (13 columns for standard Test Runner CSVs). Do not add blank rows between suites or summary footer rows at the bottom.
4. **File limits:** UTF-8 text (optional BOM stripped cleanly), max upload size `10 MiB`.

---

## 6. Complete Example CSV

```csv
Test ID,Suite,Title,Priority,Type,Status,Preconditions,Steps,Expected Result,Actual Result,Duration (s),Owner,Environment
TC-001,Authentication,Sign in with valid email and password,Critical,Functional,In Progress,Registered user on /login,"1. Enter valid email and password. 2. Submit the Sign in form.",User is redirected to /dashboard with an active session cookie.,,,QA,Chrome 134 / macOS
TC-002,Authentication,Show inline validation error for wrong password,High,Edge Case,In Progress,Registered user on /login,"1. Enter valid email and incorrect password. 2. Submit the form.",Form displays an accessible alert without clearing the email field.,,,QA,Chrome 134 / macOS
TC-003,Responsive Layout,Prevent horizontal overflow on 390px mobile viewport,Medium,UI / Visual,In Progress,Viewport resized to 390x844,"1. Load /tools/test-runner. 2. Open Import menu and inspect toolbar controls.",All buttons maintain at least 44px touch targets with zero horizontal page scroll.,,,Frontend,Safari 18 / iOS
```

---

## 7. Prompt Template for Generating Test Suites

```text
Read https://online-web-toolkit.com/test-runner-instructions.md and generate a downloadable CSV test plan for <FEATURE>.
Use the exact 13-column Test Runner CSV schema, set Status to "In Progress" on all new cases, write atomic numbered Steps, cover happy paths plus edge/accessibility/mobile cases, and ensure every row has 13 valid RFC 4180 columns.
```
