# Test Case Specification: [Feature set or test item]

> Test case specification for one feature set. The structure follows the
> test case concepts of ISO/IEC/IEEE 29119-3: each test case has an
> identifier, objective, priority, traceability, preconditions, inputs and
> expected results. Replace every `[bracketed]` value and every test case
> marked *Example*.

<!--
Guidance: How to use this template
- Derive test cases from the coverage items in the test design specification
  (quality/test-design-specification) and keep the TCI links.
- Write expected results that are observable and exact. "Works correctly" cannot fail.
- One test case checks one coverage item or one rule. Long chained cases hide
  which step failed; chain them in a test procedure instead.
- Fill "Actual result" and "Status" during execution, or keep them in your test
  management tool and leave the columns as a record of the last run.
-->

| Field | Value |
|---|---|
| Document ID | [TCS-FEATURE-001] |
| Test plan | [TP-PROJECT-001] |
| Test design specification | [TDS-FEATURE-001] |
| Test item and version | [Orders API 2.8.0, web storefront 5.1.0] |
| Version | [0.1] |
| Status | [Draft / In review / Approved] |
| Author | [@tester] |
| Reviewer | [@reviewer] |
| Last updated | YYYY-MM-DD |

## 1. Conventions

<!-- Guidance: Define the ID scheme, priority scale and status values once so every case uses them the same way. -->

- **ID format**: `TC-<AREA>-<NNN>`, for example `TC-ORD-005`. IDs are never reused.
- **Priority**: P1 (must run every cycle, high risk), P2 (run every release), P3 (run when time allows).
- **Status values**: Not run, Passed, Failed, Blocked, Not applicable.
- **Severity of failures** follows the defect scale in the test strategy.

## 2. Test case summary

<!-- Guidance: A one-line view of every case for planning and reporting. Keep it in the same order as section 4. -->

| ID | Title | Priority | Traces to | Automated | Status |
|---|---|---|---|---|---|
| TC-ORD-005 | Quantity 0 is rejected | P1 | SRS-FR-022, TCI-05 | Yes | [Not run] |
| TC-ORD-006 | Quantity 1 is accepted | P1 | SRS-FR-021, TCI-05 | Yes | [Not run] |
| TC-ORD-010 | Gold member over 100 gets 15% and free shipping | P1 | SRS-FR-024, TCI-06 | Yes | [Not run] |
| TC-ORD-026 | Unpaid order cannot be dispatched | P1 | SRS-FR-031, TCI-07 | No | [Not run] |
| [TC-AREA-nnn] | [Title] | [P1-P3] | [Requirement, TCI] | [Yes / No] | [Status] |

## 3. Shared test data

<!-- Guidance: Describe data used by several cases once here. Cases then refer to it by name. Never use real personal data. -->

| Data ID | Description | Values | Setup |
|---|---|---|---|
| TD-01 | Gold-tier customer | `gold.tester@example.test`, tier Gold, country DE | Seed script `seed/customers.ts` |
| TD-02 | Standard customer | `std.tester@example.test`, tier Standard, country DE | Seed script |
| TD-03 | Product with stock | SKU `MUG-RED-01`, price 25.00 EUR, stock 500 | Seed script |
| [TD-nn] | [Description] | [Values] | [Setup] |

## 4. Test cases

<!-- Guidance: One block per case. Keep the field order fixed so readers and tools can scan it. -->

### TC-ORD-005: Quantity 0 is rejected

| Field | Value |
|---|---|
| Objective | Verify that the lower invalid boundary of the quantity field is refused |
| Priority | P1 |
| Traceability | SRS-FR-022; TCOND-02; TCI-05; risk PR-01 |
| Technique | Boundary value analysis |
| Preconditions | Logged in as TD-02; cart is empty; product TD-03 page is open |
| Test data | TD-02, TD-03 |

| Step | Input / action | Expected result |
|---|---|---|
| 1 | Enter `0` in the quantity field | Field shows error "Enter a quantity from 1 to 99" |
| 2 | Select "Add to cart" | Button is disabled; cart count stays at 0 |
| 3 | Send `POST /cart/items` with `{"sku":"MUG-RED-01","qty":0}` | HTTP 422 with error code `QTY_OUT_OF_RANGE` |

| Execution field | Value |
|---|---|
| Actual result | [What happened] |
| Status | [Passed / Failed / Blocked] |
| Defect | [BUG-ID if failed] |
| Executed by / date / build | [@name] / YYYY-MM-DD / [build] |

### TC-ORD-006: Quantity 1 is accepted

| Field | Value |
|---|---|
| Objective | Verify that the lower valid boundary is accepted |
| Priority | P1 |
| Traceability | SRS-FR-021; TCOND-01; TCI-05 |
| Technique | Boundary value analysis |
| Preconditions | Logged in as TD-02; cart is empty |
| Test data | TD-02, TD-03 |

| Step | Input / action | Expected result |
|---|---|---|
| 1 | Enter `1` in the quantity field and select "Add to cart" | Cart count shows 1; confirmation toast "Added to cart" |
| 2 | Open the cart | One line: MUG-RED-01, quantity 1, line total 25.00 EUR |

| Execution field | Value |
|---|---|
| Actual result | [What happened] |
| Status | [Passed / Failed / Blocked] |
| Defect | [BUG-ID if failed] |
| Executed by / date / build | [@name] / YYYY-MM-DD / [build] |

### TC-ORD-010: Gold member over 100 gets 15% and free shipping

| Field | Value |
|---|---|
| Objective | Verify decision table rule R1 for discounts |
| Priority | P1 |
| Traceability | SRS-FR-024; TCOND-03; TCI-06 rule R1; risk PR-01 |
| Technique | Decision table testing |
| Preconditions | Logged in as TD-01 (Gold); cart is empty |
| Test data | TD-01, TD-03 |

| Step | Input / action | Expected result |
|---|---|---|
| 1 | Add MUG-RED-01 with quantity 4 | Subtotal 100.00 EUR |
| 2 | Proceed to checkout summary | Discount line "-15.00 EUR (Gold 15%)"; shipping 0.00 EUR; total 85.00 EUR |
| 3 | Change quantity to 3 and return to summary | Discount "-10% Gold" = -7.50 EUR; shipping 0.00 EUR (rule R2) |

| Execution field | Value |
|---|---|
| Actual result | [What happened] |
| Status | [Passed / Failed / Blocked] |
| Defect | [BUG-ID if failed] |
| Executed by / date / build | [@name] / YYYY-MM-DD / [build] |

### TC-ORD-026: Unpaid order cannot be dispatched

| Field | Value |
|---|---|
| Objective | Verify that the invalid transition Created to Shipped is refused |
| Priority | P1 |
| Traceability | SRS-FR-031; TCOND-04; TCI-07 transition T7 |
| Technique | State transition testing (invalid transition) |
| Preconditions | Order `ORD-TEST-7001` exists in state Created; tester has warehouse role |
| Test data | Order created by seed script with no payment |

| Step | Input / action | Expected result |
|---|---|---|
| 1 | In the warehouse console, open `ORD-TEST-7001` | "Mark as dispatched" button is not shown |
| 2 | Send `POST /orders/ORD-TEST-7001/dispatch` | HTTP 409 with error `INVALID_STATE_TRANSITION` |
| 3 | Read `GET /orders/ORD-TEST-7001` | State is still `Created`; audit log has a rejected-transition entry |

| Execution field | Value |
|---|---|
| Actual result | [What happened] |
| Status | [Passed / Failed / Blocked] |
| Defect | [BUG-ID if failed] |
| Executed by / date / build | [@name] / YYYY-MM-DD / [build] |

### [TC-AREA-nnn]: [Title]

| Field | Value |
|---|---|
| Objective | [What this case proves] |
| Priority | [P1 / P2 / P3] |
| Traceability | [Requirement; condition; coverage item; risk] |
| Technique | [Technique] |
| Preconditions | [State before step 1] |
| Test data | [Data IDs] |

| Step | Input / action | Expected result |
|---|---|---|
| 1 | [Action] | [Observable result] |

## 5. Review checklist

<!-- Guidance: The reviewer ticks each item before approving the specification. -->

- [ ] Every coverage item in the test design specification is covered by at least one case.
- [ ] Every expected result is specific and observable.
- [ ] Preconditions and data are reproducible by another tester.
- [ ] No case depends on another case having run first (or the dependency is stated).
- [ ] P1 cases cover every high-risk condition.

## 6. Approval

<!-- Guidance: Approval confirms the cases are ready for execution. -->

| Role | Name | Decision | Date |
|---|---|---|---|
| Test lead | [@name] | [Approved / Changes requested] | YYYY-MM-DD |
| Requirement owner | [@name] | [Decision] | YYYY-MM-DD |

## Standard and licence note

Structure aligned with ISO/IEC/IEEE 29119-3, *Software testing, Part 3:
Test documentation*, test case specification 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.
