# Frontend Results Design Specification (`resultdesign.md`)

A clean, responsive visual design specification focused strictly on the **Results View**—how test execution outcomes, health verdicts, and performance summaries are presented without clutter.

> **Note:** For deep diagnostic payloads, error response triage, and the 3-layer data presentation model, see [datadesign.md](file:///d:/CODE/JavaScript/Projects/APIintegration/frontend/datadesign.md).

---

## 1. Design Principles
1. **1-Second Verdict:** The user should immediately know if their API test passed or failed without scanning spreadsheets or dozens of dials.
2. **Mobile-First & Anti-Clutter:** No rigid desktop-only tables. Results render as clean visual cards that stack naturally on small viewports and align horizontally on desktop.
3. **Smooth Transition from Input:** When the user hits `[ Run Test ]`, the input view smoothly transitions focus to the Results section with clear execution feedback.

---

## 2. Results View Hierarchy

The Results section presents outcomes in two focused visual tiers:

```
┌────────────────────────────────────────────────────────┐
│  TIER 1: Primary Verdict & Performance Summary        │
│  (Health verdict, total requests, average speed)       │
├────────────────────────────────────────────────────────┤
│  TIER 2: Engine-Specific Outcome Visualizer            │
│  • Concurrency: Breaking point & cycle progress track  │
│  • Sequence: Vertical workflow step pipeline           │
│  • Validation: Latency percentile speed ribbon         │
└────────────────────────────────────────────────────────┘
```

---

## 3. Tier 1: Primary Verdict Card (Universal)

Mounted at the top of the Results view upon test completion.

### 3.1. Success Verdict (All Requests Passed)
```
┌────────────────────────────────────────────────────────┐
│                                                        │
│                    ✅ ALL PASSED                       │
│                                                        │
│       500 requests completed  •  42 ms average speed   │
│                                                        │
│         "System stayed rock-solid under load."         │
│                                                        │
└────────────────────────────────────────────────────────┘
```
- **Status Badge:** Prominent confirmation chip (`✅ ALL PASSED`).
- **Core Numbers:**
  - Total requests completed (`metrics.latency.count`).
  - Average latency (`metrics.latency.averageMs`).
- **Contextual Summary:** Single sentence confirming stability.

### 3.2. Degraded / Failed Verdict
```
┌────────────────────────────────────────────────────────┐
│                                                        │
│                   ⚠️ 8 REQUESTS FAILED                 │
│                                                        │
│       492 succeeded  •  8 timed out (504 Gateway)      │
│                                                        │
│   "Ran clean up to 100 users, then broke at 150 users" │
│                                                        │
└────────────────────────────────────────────────────────┘
```
- **Status Badge:** Highlighting error count and dominant issue.
- **Core Numbers:** Ratio of succeeded vs failed requests.
- **Breaking Point Insight:** Plain sentence identifying the saturation threshold.

---

## 4. Tier 2: Engine-Specific Outcome Visualizer

Adapts cleanly based on the engine used:

### 4.1. Concurrency & Load Test View
- **Breaking-Point Alert:**
  - A prominent notice highlighting the exact concurrency level where errors emerged:
    `⚠️ Saturation detected at Cycle 4 (150 Concurrency) — Failure rate reached 14%`
- **Cycle Progression Track:**
  - Each cycle renders as a clean horizontal progress bar (not a dense table):
    - `Cycle 1 (50 VUs)`: `[████████████████████]` 50/50 Passed
    - `Cycle 2 (100 VUs)`: `[██████████████████░]` 98/100 Passed
    - `Cycle 3 (150 VUs)`: `[█████████████░░░░░░]` 70/100 Passed (30 Failed)
- **Cycle-over-Cycle A/B Comparator:**
  - Dropdown to compare baseline vs peak cycle:
    Shows clean delta tags: `Δ Concurrency: +100%`, `Δ Errors: +12%`.

### 4.2. Sequence Simulation View (Workflow Pipeline)
- **Vertical Step Pipeline:**
  - Renders multi-step workflows as a vertical checklist/timeline:
    - `Step 1: Auth Token Generation` ── `[ ✅ Passed • 45 ms ]`
    - `Step 2: Fetch User Profile` ── `[ ✅ Passed • 82 ms ]`
    - `Step 3: Process Checkout` ── `[ ❌ Failed • HTTP 504 ]`
    - `Step 4: Send Notification` ── `[ ⏳ Skipped ]`
  - Each step has a subtle proportional duration bar highlighting the slowest stage in the chain.

### 4.3. Validation & Fuzzing View
- **Percentile Speed Ribbon:**
  - A clean visual curve or segmented track showing response times across percentiles:
    `Min (12ms) ── p50 (42ms) ── p75 (65ms) ── p90 (110ms) ── p99 (310ms) ── Max (450ms)`
  - SLA threshold overlay line (default `300 ms`) with an alert if breached.

---

## 5. Run History & A/B Comparison

Located at the bottom of the Results screen:

- **Recent Runs List:**
  - Compact cards stored in `localStorage`:
    - `Run #14 — Concurrency (150 VUs) — 98.4% Success — 42ms avg (Just now)`
    - `Run #13 — Validation Test — 100% Success — 38ms avg (15 mins ago)`
- **A/B Run Comparison:**
  - Allows selecting two historical runs to calculate performance deltas:
    - $\Delta$ Average Latency: `+4 ms`
    - $\Delta$ Success Rate: `-1.6%`
    - $\Delta$ Throughput: `+50 req/s`

---

## 6. Responsive Viewport Behavior

| Viewport | Primary Verdict (Tier 1) | Outcome Visualizer (Tier 2) | Run History |
| :--- | :--- | :--- | :--- |
| **Mobile (< 640px)** | Full-width centered card | Stacked vertical progress bars / pipeline | Single-column history cards |
| **Tablet (640px–1024px)** | Centered card (max-w-xl) | Scaled responsive charts & steps | 2-column comparison layout |
| **Desktop (> 1024px)** | Centered card (max-w-2xl) | Expanded visual tracks with side-by-side deltas | Side-by-side run comparator |
