Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

14 — QA Checklist (Exams Module)

Test checklist grounded in the implemented backend contract. Every item is traceable to a source behavior; run against 00-shared/10_QA_Baseline.md. Coverage targets: unit (cubits/forms), widget, integration (mock API), E2E (against npm run test:e2e stack with MongoDB + Redis).


1. Functional — planning (S1/S2/S4/S8)

  • List loads page 1 (limit default 20); scrolling appends pages; hasNext: false shows end-of-list; pull-to-refresh resets to page 1 (examination.service.ts:67-79).
  • Create exam → POST returns doc with status: 'draft' regardless of payload (examination.service.ts:48); detail shows badge draft.
  • Edit exam → PATCH $set only sent fields; version increments (base.repository.ts:57-66); unchanged fields untouched.
  • Delete exam → soft delete; exam disappears from list; slots/results remain (no cascade — examination.service.ts:99-110); direct slot read after delete → 404.
  • Add subject slot → appears in GET /examinations/:id/subjects order; examinationId taken from route, never from body (examination.service.ts:49).
  • Slot fields persist exactly: date (Date), startTime/endTime as 'HH:mm' strings, maximumMarks/passingMarks numbers (examination-subject.schema.ts:18-31).

2. Validation & edge cases (module-specific)

  • Max marks: submit marksObtained > maximumMarks → server returns 404 NotFoundException "Marks cannot exceed maximum." (examination.service.ts:145-146); client pre-validation blocks typing beyond max digits and shows inline error; server 404 path → slot-max refresh + re-enter.
  • Pass marks: client blocks passingMarks > maximumMarks (OQ-6); server accepts (both @Min(1) only, examination-subject.dto.ts:36-44) — confirm the warning banner on SlotHeaderCard when an invalid config exists server-side.
  • Duplicate exam-subject: adding the same subject twice succeeds server-side (non-unique index, examination-subject.schema.ts:37) — client warns "already scheduled" (OQ-3); confirm warn-then-proceed flow.
  • Subject date conflicts: no server rejection (OQ-2) — verify the overlap warning dialog on submit and that "add anyway" proceeds.
  • Exam window inversion (startDate > endDate) and time inversion (endTime ≤ startTime) → client-only inline errors; server accepts — verify the client refuses to submit (OQ-6).
  • Publish immutability: after publish — Publish/Edit/Delete/Add-subject hidden; marks edits show published confirm sheet (OQ-5). Verify against server: re-POST publish succeeds (no guard, examination.service.ts:203-220) and PATCH status 'garbage' persists without enum validation (updateById no runValidators) — document as known server gaps, client must not rely on them.
  • Status transitions: create → draft; publish → published; active/ completed only via explicit user action (OQ-1); client never sends status on create; status picker disabled when published.
  • Missing marks on report card: subject without result → 0/max + "not marked" hint; all-unmarked exam → percentage 0, grade F with explanatory note (result.service.ts:70, 83-95, 137).
  • Empty slot list on report card: 404 "No subjects found for this examination." → empty state, no retry loop (result.service.ts:51-53).
  • Free-text per-subject grade: grade sent as-is (A+/A/B+/B/C/D/F suggested); empty grade renders "—" (examination-subject.dto.ts:57-60; OQ-9).
  • Marks upsert: same student+slot saved twice → single doc, second write updates in place (examination.service.ts:147-175); unique index {tenantId, studentId, examinationSubjectId} (examination-result.schema.ts:31-33).

3. Errors & resilience

  • 404 "Examination not found." → purge cache, pop to list, snackbar (examination.service.ts:63, 87, 101).
  • 404 "Exam subject not found." → pop to detail, refresh slots (examination.service.ts:144).
  • 400 VALIDATION_ERROR → inline field errors, first invalid focused.
  • 429 → backoff + countdown, no auto-retry (00-shared/07 §4).
  • 5xx → generic + requestId, retry offered, last-good cache served.
  • Offline marks entry: rows queue (dashed + cloud icon); flush on reconnect with idempotency; dedupe last-write-wins; 5-attempt cap surfaces "review" state; 409 flush collision → preview sheet (overwrite/discard) (13 §4).
  • Publish offline → disabled (online-only); never optimistic flip (13 §2).

4. A11y (00-shared/09)

  • Status badges: icon + label + text (never color-only); screen reader reads "status {status}".
  • Marks rows: "{student}, {marks} of {max}"; errors announced; Enter saves + advances focus; Tab order stable; 48 dp targets; reduced motion halves durations.
  • Publish dialog: focus trap, Escape cancels, progress announced; live-region on coverage bar and publish badge flip.
  • Report card table: headers announced; grade badge label with threshold text.
  • Color contrast in dark mode: tertiaryContainer badges, muted "not marked" rows ≥ 4.5:1.

5. Responsive & theming

  • Phone (≤600 dp): stacked cards, marks rows full-width, sheets for grade/ conflict.
  • Tablet (≥840 dp): master–detail list+detail; marks screen right rail; report card real table.
  • Dark/light: token-only swap; published badge & coverage bar verified in both.
  • Keyboard: N new exam, P publish (desktop); no overflow at 320 dp width.

6. Performance

  • List first page < 500 ms p95 (cached); marks save round-trip < 500 ms p95.
  • Coverage tab N+1 bounded: one GET /results/exam-subject/:id per slot, serialized or throttled ≤ 4 concurrent; no re-fetch on tab switch without change.
  • Marks screen with 60-student roster: no jank, row save never blocks typing.
  • Report card cached 24 h when published; 5 min otherwise (13 §6).

7. Security & tenancy

  • Cross-tenant :id → 404, never leaks existence (base.repository.ts:20-30).
  • tenantId never sent in bodies; x-request-id echoed (00-shared/07 §6, response-envelope.interceptor.ts:44).
  • No secrets in logs/screens; error UI uses server codes + i18n keys (00-shared/07 §11).
  • RBAC: when exam.* lands (OQ-4) — 403 hides actions, read-only state, server authoritative.

8. Analytics (proposed)

  • Events per 05_Screen_Inventory.md fire on: list view, row tap, create start, detail view, publish tap/success/failure, marks open/save/fail, coverage, slot add (+conflict warned), results view, report card view/share.