# Test Procedure Specification: [Test set or scenario name]

> Test procedure specification. The structure follows the test procedure
> concepts of ISO/IEC/IEEE 29119-3: test sets, the ordered steps to run
> them, setup and teardown, dependencies, environment, data and stop or
> restart conditions. Replace every `[bracketed]` value and every row
> marked *Example*.

<!--
Guidance: How to use this template
- A procedure puts test cases into an executable order. Group cases into test
  sets that share setup, then write the steps a tester (or a script) follows.
- Write steps for someone who has never seen the system. If a step needs
  tribal knowledge, the procedure is not finished.
- Each step has an expected result, so a failure is noticed at the step where
  it happens, not three steps later.
- Keep stop and restart conditions explicit; they protect test data and save
  time when an environment breaks.
-->

| Field | Value |
|---|---|
| Document ID | [TPR-FEATURE-001] |
| Test plan | [TP-PROJECT-001] |
| Test case specification | [TCS-FEATURE-001] |
| Test item and build | [Web storefront 5.1.0-rc2, Orders API 2.8.0] |
| Execution mode | [Manual / Automated / Semi-automated] |
| Estimated duration | [45 minutes] |
| Version | [0.1] |
| Status | [Draft / In review / Approved] |
| Author | [@tester] |
| Last updated | YYYY-MM-DD |

## 1. Purpose

<!-- Guidance: One paragraph: what this procedure proves and when it runs (each cycle, each release candidate, smoke only). -->

This procedure executes the checkout regression test set for [product]
against each release candidate. It confirms that quantity validation,
discounts and order state changes still behave as specified after any
change to the checkout or order services.

## 2. Test sets

<!-- Guidance: A test set is a group of cases run together because they share preconditions or data. List them in the order the procedure runs them. -->

| Test set | Test cases (in order) | Shared preconditions | Priority |
|---|---|---|---|
| TS-A Cart validation | TC-ORD-005, TC-ORD-006, TC-ORD-007, TC-ORD-008 | Standard customer logged in, empty cart | P1 |
| TS-B Discounts | TC-ORD-010, TC-ORD-011, TC-ORD-012, TC-ORD-013 | Gold and Standard customers available | P1 |
| TS-C Order lifecycle | TC-ORD-020, TC-ORD-022, TC-ORD-026, TC-ORD-027 | Warehouse role, seeded orders | P1 |
| [TS-x] | [Cases] | [Preconditions] | [Priority] |

## 3. Environment

<!-- Guidance: State exactly where the procedure runs, with versions, so results can be reproduced. -->

| Item | Value |
|---|---|
| Environment | [System test, `https://st.example.test`] |
| Browser / device | [Chrome stable on Windows 11; Safari on iOS 18 for TS-A only] |
| Services and versions | [Orders API 2.8.0, Pricing 1.14.2, payment sandbox] |
| Tools | [Test management tool], [REST client], [Playwright 1.x for automated steps] |
| Access | Accounts in section 4; warehouse console role `wh-tester` |

## 4. Test data

<!-- Guidance: Name the data each set uses and how it is created. Prefer data the procedure creates itself over shared data that other testers can change. -->

| Data | Used by | Creation | Reset |
|---|---|---|---|
| TD-01 Gold customer `gold.tester@example.test` | TS-B | `pnpm seed:customers` | Setup step S3 |
| TD-02 Standard customer `std.tester@example.test` | TS-A, TS-B | `pnpm seed:customers` | Setup step S3 |
| TD-03 Product `MUG-RED-01`, stock 500 | All | `pnpm seed:catalog` | Setup step S3 |
| Orders `ORD-TEST-7001` to `ORD-TEST-7004` | TS-C | `pnpm seed:orders` | Teardown step D2 |

## 5. Dependencies

<!-- Guidance: List what must be true or done before this procedure, including other procedures. -->

- Smoke test procedure [TPR-SMOKE-001] has passed on the same build.
- Pricing service has the current promotion configuration (`promo-2026Q1`).
- No other tester is running TS-C in the same environment (orders are shared).

## 6. Setup

<!-- Guidance: Steps to bring the environment and data to the starting state. Each step has a check. -->

| Step | Action | Expected result |
|---|---|---|
| S1 | Confirm the deployed build in `/health` | `version` equals the build under test |
| S2 | Clear browser storage and log out all sessions | Login page shown |
| S3 | Run `pnpm seed:reset && pnpm seed:customers && pnpm seed:catalog` | Script exits with code 0; three records reported |
| S4 | Run `pnpm seed:orders` | Four test orders listed in state Created or Paid |
| S5 | Start screen recording and open the test run in [tool] | Run ID recorded in section 9 |

## 7. Procedure steps

<!-- Guidance: Ordered steps. Reference the test case for detail instead of copying it, but keep the expected result at step level. Record the outcome in the last column during execution. -->

| Step | Test case | Action | Expected result | Outcome |
|---|---|---|---|---|
| 1 | TC-ORD-005 | Log in as TD-02, open MUG-RED-01, enter quantity 0 | Error "Enter a quantity from 1 to 99"; add button disabled | [Pass / Fail] |
| 2 | TC-ORD-006 | Enter quantity 1, add to cart | Cart count 1 | [Pass / Fail] |
| 3 | TC-ORD-007 | Set quantity to 99 in the cart | Line total 2,475.00 EUR | [Pass / Fail] |
| 4 | TC-ORD-008 | Set quantity to 100 in the cart | Error shown; quantity reverts to 99 | [Pass / Fail] |
| 5 | (cleanup) | Empty the cart and log out | Cart count 0 | [Pass / Fail] |
| 6 | TC-ORD-010 | Log in as TD-01, add 4 x MUG-RED-01, open summary | Discount -15.00 EUR, shipping 0.00, total 85.00 EUR | [Pass / Fail] |
| 7 | TC-ORD-011 | Change quantity to 3 | Discount -7.50 EUR, shipping 0.00 | [Pass / Fail] |
| 8 | TC-ORD-012 | Log out, log in as TD-02, add 4 x MUG-RED-01 | Discount -5.00 EUR, shipping 0.00 | [Pass / Fail] |
| 9 | TC-ORD-013 | Change quantity to 3 | No discount; shipping charged | [Pass / Fail] |
| 10 | TC-ORD-020 | In warehouse console, capture payment on `ORD-TEST-7001` | State Paid | [Pass / Fail] |
| 11 | TC-ORD-022 | Mark `ORD-TEST-7001` dispatched | State Shipped; tracking number field required | [Pass / Fail] |
| 12 | TC-ORD-026 | Call dispatch API on `ORD-TEST-7002` (Created) | HTTP 409 `INVALID_STATE_TRANSITION` | [Pass / Fail] |
| 13 | TC-ORD-027 | Try to cancel delivered order `ORD-TEST-7004` | Cancel option hidden; API returns 409 | [Pass / Fail] |
| [n] | [TC-ID] | [Action] | [Expected] | [Outcome] |

## 8. Stop, wrap-up and restart

<!-- Guidance: Say when to stop, how to leave the environment safe, and where to resume. Without this, a half-run procedure corrupts data for the next tester. -->

### 8.1 Stop conditions

- A P1 step fails with a severity-1 or severity-2 defect: finish the current test set, then stop.
- The environment returns HTTP 5xx on three consecutive steps: stop immediately.
- Seed data is found modified by another user: stop and notify the test lead.

### 8.2 Teardown

| Step | Action | Expected result |
|---|---|---|
| D1 | Log out all test accounts | Login page shown |
| D2 | Run `pnpm seed:orders --purge` | Test orders removed |
| D3 | Stop recording; attach logs and recording to the run | Attachments visible in [tool] |

### 8.3 Restart

Restart from the first step of the interrupted test set after repeating
setup steps S1 to S4. Completed sets do not need to be repeated unless
the build changed.

## 9. Execution record

<!-- Guidance: Fill once per run. Keep earlier runs for trend analysis or move them to the test management tool. -->

| Run ID | Build | Executed by | Date | Duration | Passed | Failed | Blocked | Defects raised |
|---|---|---|---|---|---|---|---|---|
| *Example:* RUN-0412 | 5.1.0-rc2 | [@name] | YYYY-MM-DD | 52 min | 12 | 1 | 0 | BUG-3381 |
| [Run ID] | [Build] | [@name] | YYYY-MM-DD | [min] | [n] | [n] | [n] | [IDs] |

## Standard and licence note

Structure aligned with ISO/IEC/IEEE 29119-3, *Software testing, Part 3:
Test documentation*, test procedure concepts. This template is original
text written for this collection and reproduces no text from the
standard; obtain the standard for its normative requirements. Template
licence: MIT.
