Manual Testing Guide

This commit is contained in:
Prashant Shendre 2026-10-12 10:20:38 +05:30
parent 59685755e7
commit 72cc2b7098
2 changed files with 188 additions and 29 deletions

View File

@ -1,43 +1,189 @@
# Manual Testing Guide — Iteration 01 (IAM & Access Control)
# Comprehensive Manual Testing Guide — Iteration 01
## Identity, Authentication, Session Governance & Role-Based Access Control
| Field | Value |
|---|---|
| **Iteration** | Iteration 01 |
| **Scope Slice** | User Identity, Authentication, and RBAC Governance (`UC-001`) |
| **Governed Standard** | UP-AI v1.0 Dual Manual QA Standard |
| **Status** | Rebaselined under CR-001; pending construction and QA execution |
| **Version** | 1.1.0 |
| **Document ID** | `MTG-ITERATION-01` |
| **Governed Standard** | SEI-CMMI Level 3 (UP-AI v1.5 Quality Standard) |
| **Iteration** | `iteration-01` |
| **Scope Slice** | User Authentication, RBAC Governance & Session Lifecycle ([`UC-001`](../../../03_requirements/use_cases/uc-001_user-authentication/use-case.md)) |
| **Child Requirements** | [`FR-AUTH-001`](../../../03_requirements/use_cases/uc-001_user-authentication/functional-reqs.md#fr-auth-001-oidc-authentication), [`FR-AUTH-002`](../../../03_requirements/use_cases/uc-001_user-authentication/functional-reqs.md#fr-auth-002-role-based-authorization), [`FR-AUTH-003`](../../../03_requirements/use_cases/uc-001_user-authentication/functional-reqs.md#fr-auth-003-session-handling-and-logout) |
| **Associated Screens** | [`SCREEN-AUTH-001`](../../06_wireframes/screen_specs/SCREEN-AUTH-001_login.md), [`SCREEN-AUTH-002`](../../06_wireframes/screen_specs/SCREEN-AUTH-002_access_denied.md), [`SCREEN-AUTH-003`](../../06_wireframes/screen_specs/SCREEN-AUTH-003_session_logout.md) |
| **Associated APIs** | `GET /api/v1/auth/session`, `POST /api/v1/auth/logout`, Cross-cutting RBAC Middleware |
| **21-Sheet QA Workbook** | [`Iteration01_Authentication_and_Session_Governance_Complete_Manual_Testcases.xlsx`](../workbooks/Iteration01_Authentication_and_Session_Governance_Complete_Manual_Testcases.xlsx) |
| **Status** | Approved QA Specification (Ready for Construction Verification) |
| **Version** | 1.2.0 |
| **Last CR** | `CR-001` |
---
## 1. Test Environment Setup & Disposable Personas
## 1. Executive Summary & Objective
### Preconditions
- Staging / Dev environment active with Keycloak identity realm seeded.
- Test personas configured:
- **Persona 1:** A test user with a PRD-defined role permitted for the selected action.
- **Persona 2:** A test user with a PRD-defined role prohibited from the selected action under `BRD-FR-040`.
- Tenant membership and cross-tenant isolation cases are covered by UC-019 and UC-017/UC-020 test suites.
This manual testing guide is authored specifically for Quality Assurance (QA) and Adversarial Testing engineers executing manual exploratory, regression, security boundary, and usability tests on **Iteration 01**.
The objective of Iteration 01 manual verification is to rigorously validate:
1. The **OIDC PKCE authentication flow** between the React frontend, Keycloak identity provider (or deterministic identity sandbox), and FastAPI backend.
2. The enforcement of the **11 PRD roles permission matrix** and **strict segregation of duties** mandated by `BRD-FR-040`.
3. The **application session lifecycle**, ensuring that user-initiated logouts completely terminate server and client session validity, preventing replay or unauthorized reuse.
This guide complements the **21-Sheet Excel Manual QA Workbook** containing 32 categorized test cases.
---
## 2. Manual Test Procedures
## 2. Test Environment & Pre-Requisites
### Procedure 1: OIDC Login and Protected Access
1. Open web browser to portal URL.
2. Click "Login with Enterprise SSO".
3. Verify redirection to Keycloak login screen with PKCE parameters in URL query.
4. Authenticate as `admin@enterprise-demo.com`.
5. Verify the configured OIDC flow establishes an application session and a protected operation is available to an authenticated user. Tenant selection/context behavior is tested under UC-019.
### 2.1 Supported Test Topologies
### Procedure 2: Role Permission and Segregation-of-Duties Guard
1. Log in as a user whose PRD-defined role is prohibited from a selected action.
2. Attempt the protected action (for example, a Sales Executive attempting to override a credit lock).
3. Verify the action is denied and no business state change occurs.
QA engineers can execute test scenarios against two approved topologies:
### Procedure 3: Application Session Logout
1. Use the supported application logout control.
2. Confirm the application reports that the session has ended.
3. Attempt a protected operation using the ended application session.
4. Verify access is denied. Do not assert a specific token-revocation implementation or timing.
1. **Topology A — Full Docker Compose Stack (Live Keycloak OIDC):**
- Started via `docker compose -f 05_implementation_workspace/compose.yaml up -d`.
- PostgreSQL running on port `5432`, Keycloak on `http://localhost:8080`, Valkey on `6379`.
- Realm: `atb-realm` pre-seeded with test client `atb-web-portal`.
2. **Topology B — Deterministic Mock Mode (Offline / Sandbox):**
- Configured via environment variable `USE_IDENTITY_MOCK=true`.
- Uses `sandbox/identity_mock.py` to deterministically mint signed test JWTs and validate PKCE flows without network access.
### 2.2 Client Application Preconditions
- Web browser: Chromium (Desktop), Firefox (Desktop), or Safari (WebKit).
- Web portal URL: `http://localhost:3000` (or configured dev port).
- Local storage / session storage cleared prior to initiating each test suite.
---
## 3. Disposable QA Personas & Credentials Matrix
All test scenarios must utilize the following pre-configured disposable test personas to ensure test repeatability and isolation:
| Persona ID | Email / Username | Password | Assigned PRD Role | Primary Permissions | Mandatory Segregation Restrictions |
|---|---|---|---|---|---|
| `PER-ADM` | `admin@alpha.com` | `TestPass123!` | `Tenant Administrator` | User management, settings, tenant config | Scoped strictly to verified tenant membership |
| `PER-BUY` | `buyer@alpha.com` | `TestPass123!` | `Mandi Buyer` | View market, draft procurement saudas | Cannot approve payments |
| `PER-MGR` | `pmgr@alpha.com` | `TestPass123!` | `Purchase Manager` | Confirm procurement saudas, manage suppliers | Cannot conduct weighment / QC |
| `PER-YRD` | `yard@alpha.com` | `TestPass123!` | `Yard Supervisor` | Gate entry, inward weighment | **CANNOT confirm sales contracts** |
| `PER-QC` | `qc@alpha.com` | `TestPass123!` | `Quality Officer` | Quality assay, lot hold/release | **CANNOT edit market or sauda prices** |
| `PER-SAL` | `sales@alpha.com` | `TestPass123!` | `Sales Executive` | Create sales contracts, view customers | **CANNOT override customer credit locks** |
| `PER-SMG` | `smgr@alpha.com` | `TestPass123!` | `Sales Manager` | Approve sales contracts, allocate lots | Credit override requires MD justification |
| `PER-LOG` | `logistics@alpha.com` | `TestPass123!` | `Logistics Coordinator`| Fleet management, outward dispatch, POD | Cannot issue credit notes |
| `PER-ACC` | `finance@alpha.com` | `TestPass123!` | `Accounts Executive` | Bank receipts, supplier vouchers | Cannot alter weighment or assay data |
| `PER-DIR` | `director@alpha.com` | `TestPass123!` | `Partner / MD` | Executive dashboard, credit override | Audited and immutable override logging |
| `PER-SYS` | `sysadmin@atb.io` | `SysPass123!` | `System Administrator` | Platform health, tenant provisioning | No business ledger mutation |
---
## 4. Detailed Step-by-Step Manual QA Test Protocols
### Protocol 1: End-to-End OIDC Authorization Code Flow with PKCE
- **Target Requirement:** `FR-AUTH-001`
- **Related Test Cases:** `TC-AUTH-001`, `Functional_Testcase #1`, `Security_Testcase #1`
- **Applicable Screen:** [`SCREEN-AUTH-001`](../../06_wireframes/screen_specs/SCREEN-AUTH-001_login.md)
| Step # | Action | Test Data / Payload | Expected Result | Pass/Fail Criteria |
|---|---|---|---|---|
| 1.1 | Clear browser cache and navigate to portal root URL `http://localhost:3000/`. | URL: `/` | User is automatically intercepted and redirected to `/login`. | URL displays `/login`. Login UI matches `SCREEN-AUTH-001`. |
| 1.2 | Click "Sign In with Enterprise ID" button. | N/A | Browser redirects to Keycloak OIDC login page. URL contains `response_type=code`, `code_challenge`, `code_challenge_method=S256`, and `state`. | URL query parameters verify PKCE S256 challenge generation. |
| 1.3 | Enter credentials for persona `PER-BUY` (`buyer@alpha.com`). | Username: `buyer@alpha.com`<br>Password: `TestPass123!` | Keycloak authenticates user and redirects to callback URL `/auth/callback?code=...&state=...`. | No credentials leaked in application logs. |
| 1.4 | Observe frontend callback processing. | Callback query params | Frontend intercepts callback code, exchanges code for JWT tokens via client adapter, and invokes `GET /api/v1/auth/session`. | User lands on dashboard (`/`); user badge displays `Mandi Buyer`. |
| 1.5 | Open browser DevTools Network tab and inspect `GET /api/v1/auth/session`. | Header: `Authorization: Bearer <jwt>` | Backend responds with HTTP `200 OK`:<br>`{"authenticated": true, "subject": "usr_...", "roles": ["Mandi Buyer"]}`. | HTTP 200 returned. No sensitive secrets or tokens exposed in response body. |
---
### Protocol 2: Token Expiry, Replay & Malformed Token Boundary Check
- **Target Requirement:** `FR-AUTH-001`
- **Related Test Cases:** `TC-AUTH-002`, `Boundary-Value_Testcase #1`, `Negative_Testcase #1`
- **Applicable APIs:** `GET /api/v1/auth/session`, Bruno collection [`get-session.bru`](../../../docs/api/bruno/auth/get-session.bru)
| Step # | Action | Test Data / Payload | Expected Result | Pass/Fail Criteria |
|---|---|---|---|---|
| 2.1 | Send GET request to `/api/v1/auth/session` with an expired JWT token (e.g. `exp` set 1 hour in the past). | Header: `Authorization: Bearer <expired_token>` | Backend rejects request with HTTP `401 Unauthorized` and JSON error `{"code": "TOKEN_EXPIRED", "message": "Token expired"}`. | HTTP 401 returned; no internal stack trace leaked. |
| 2.2 | Send GET request to `/api/v1/auth/session` with a forged/tampered signature. | Modifying the last 5 characters of the JWT signature | Backend signature verification fails. Request rejected with HTTP `401 Unauthorized` (`INVALID_SIGNATURE`). | HTTP 401 returned; access denied. |
| 2.3 | Send request to `/api/v1/auth/session` with malformed header (e.g. `Authorization: Basic 123` or missing `Bearer`). | Header: `Authorization: Basic dXNlcjpwYXNz` | Backend rejects with HTTP `401 Unauthorized` (`INVALID_HEADER`). | HTTP 401 returned. |
| 2.4 | Attempt to reuse authorization code `code` twice on `/auth/callback`. | Replaying used authorization code | Keycloak / identity mock rejects duplicate code exchange with `invalid_grant`. | One-time use enforced. |
---
### Protocol 3: Role Permission Matrix Enforcement
- **Target Requirement:** `FR-AUTH-002`
- **Related Test Cases:** `TC-AUTH-003`, `Security_Testcase #2`, `Validation_Testcase #1`
- **Applicable Screen:** [`SCREEN-AUTH-002`](../../06_wireframes/screen_specs/SCREEN-AUTH-002_access_denied.md)
| Step # | Action | Persona / Role | Target Operation | Expected Result |
|---|---|---|---|---|
| 3.1 | Log in as Mandi Buyer (`PER-BUY`). | `Mandi Buyer` | View Market Desk (`GET /api/v1/market-observations`) | Allowed: HTTP `200 OK`. UI renders market desk. |
| 3.2 | Attempt to approve an expense voucher as Mandi Buyer. | `Mandi Buyer` | `POST /api/v1/expenses/vouchers` | Denied: HTTP `403 Forbidden`. UI displays `SCREEN-AUTH-002` Access Denied. |
| 3.3 | Log in as Accounts Executive (`PER-ACC`). | `Accounts Executive` | Record Receipt (`POST /api/v1/receivables/receipts`) | Allowed: HTTP `200/201 OK`. |
| 3.4 | Attempt to confirm sauda contract as Accounts Executive. | `Accounts Executive` | `POST /api/v1/procurement/contracts` | Denied: HTTP `403 Forbidden` (`INSUFFICIENT_PERMISSIONS`). |
| 3.5 | Log in as Tenant Administrator (`PER-ADM`). | `Tenant Administrator` | Manage Memberships (`POST /api/v1/tenants/{id}/memberships`) | Allowed within administrator's tenant. |
| 3.6 | Attempt cross-tenant membership modification as Tenant Administrator. | `PER-ADM` (Tenant Alpha) | Target: Tenant Beta (`tenant-beta`) | Denied: HTTP `403/404` with strict tenant boundary enforcement. |
---
### Protocol 4: Segregation-of-Duties (SoD) Negative Security Invariants
- **Target Requirement:** `FR-AUTH-002`
- **Related Test Cases:** `TC-AUTH-003`, `Negative_Testcase #2`, `Security_Testcase #3`
- **Applicable Policy:** `BRD-FR-040` Mandatory Segregation Constraints
| Step # | Segregation Constraint | Actor / Persona | Attempted Prohibited Operation | Expected Result |
|---|---|---|---|---|
| 4.1 | **SoD Rule 1:** Quality Officers cannot edit prices. | `PER-QC` (`Quality Officer`) | Send PUT request to modify commodity rate (`PUT /api/v1/market-observations/123/rates`). | Request intercepted by RBAC middleware and rejected with HTTP `403 Forbidden`. Error message specifies SoD policy restriction. |
| 4.2 | **SoD Rule 2:** Yard Supervisors cannot confirm sales contracts. | `PER-YRD` (`Yard Supervisor`) | Attempt to confirm customer sales order (`POST /api/v1/sales/contracts/confirm`). | Request rejected with HTTP `403 Forbidden`. Sales state machine remains in `Draft`. |
| 4.3 | **SoD Rule 3:** Sales Executives cannot override customer credit locks. | `PER-SAL` (`Sales Executive`) | Attempt partner credit override (`POST /api/v1/customers/cust-1/credit-overrides`). | Request rejected with HTTP `403 Forbidden`. Only Partner / MD (`PER-DIR`) with audited justification can execute override. |
---
### Protocol 5: Voluntary Session Termination & Logout Lifecycle
- **Target Requirement:** `FR-AUTH-003`
- **Related Test Cases:** `TC-AUTH-004`, `Functional_Testcase #2`, `Security_Testcase #4`
- **Applicable Screen:** [`SCREEN-AUTH-003`](../../06_wireframes/screen_specs/SCREEN-AUTH-003_session_logout.md)
- **Applicable API:** `POST /api/v1/auth/logout`, Bruno collection [`logout.bru`](../../../docs/api/bruno/auth/logout.bru)
| Step # | Action | Test Data / Payload | Expected Result | Pass/Fail Criteria |
|---|---|---|---|---|
| 5.1 | Log in as `PER-BUY` (`buyer@alpha.com`). Confirm active session via `GET /api/v1/auth/session`. | Active valid session | Session is authenticated and responsive. | HTTP 200 returned. |
| 5.2 | Navigate to `/account/sessions` (or click User Profile menu -> "Log Out"). | Click "Log Out" | Frontend calls `POST /api/v1/auth/logout` with Bearer token. | Backend responds with HTTP `200 OK`: `{"status": "logged_out"}`. |
| 5.3 | Inspect browser storage immediately following logout. | LocalStorage, SessionStorage, Cookies | Client-side tokens and authentication state in Zustand store are purged. | Storage is clean; `isAuthenticated === false`. |
| 5.4 | Verify automatic navigation redirect. | Browser navigation | Browser redirects immediately to `/login`. | User lands on `/login`. |
| 5.5 | **FSM Invariant Test:** Using the previously active JWT token (saved prior to logout), attempt a protected operation via curl or Bruno (e.g. `GET /api/v1/auth/session`). | Header: `Authorization: Bearer <ended_token>` | Request is denied with HTTP `401 Unauthorized` (`SESSION_TERMINATED` / `INVALID_TOKEN`). | Former session CANNOT be reused under any circumstances. |
| 5.6 | Click the browser "Back" button after logout. | Browser History Back | Browser navigation guard intercepts cached view, prevents page render, and redirects back to `/login`. | No sensitive business data cached or visible in history. |
---
### Protocol 6: Offline Deterministic Mock Mode Validation
- **Target Requirement:** `FR-AUTH-001`, `tech-profile.yaml` Wave 0 Sandbox
- **Related Test Cases:** `Integration_Testcase #1`, `Automation_Testcase #1`
| Step # | Action | Expected Result | Pass/Fail Criteria |
|---|---|---|---|
| 6.1 | Stop Keycloak container (`docker stop atb-keycloak`). Set `USE_IDENTITY_MOCK=true`. | Backend switches to `sandbox/identity_mock.py`. | Backend logs: `Deterministic identity mock active`. |
| 6.2 | Open `/login` in browser. Select persona "Mandi Buyer (`buyer@alpha.com`)" and click "Mock Authenticate". | Mock adapter generates deterministic JWT signed by local test keypair. Session established. | Dashboard loads without network access or Keycloak connectivity. |
| 6.3 | Run automated test runner: `scripts/run_tests.sh --scope iteration-01`. | All unit, contract, and mock integration tests execute and pass 100% offline. | Zero network connection failures. |
---
## 5. Defect Severity & Reporting Protocol
When an unexpected behavior or failure is encountered during manual execution, QA engineers must classify and report it according to the following criteria:
| Severity Level | Definition | Example Scenario | Process Escalation Action |
|---|---|---|---|
| **P0 (Blocker)** | Complete failure of authentication gateway; unable to log in or log out. | Login throws 500 error; all users locked out. | Stop testing; immediate developer escalation. |
| **P1 (Critical)** | Security vulnerability, broken segregation of duties, or session reuse. | Quality Officer successfully edits sauda price; logged-out token still accepted. | Flag as critical security defect; blocks Gate 14.1 closure. |
| **P2 (Major)** | Incorrect error response code, misleading UI text, or missing role permissions. | User denied with 500 instead of 403; UI button not disabled for unauthorized role. | File defect in iteration defect backlog for Stage 14 fix. |
| **P3 (Minor)** | Visual alignment issues, spacing, or non-functional styling inconsistencies. | Login banner padding misaligned on tablet viewport. | File minor styling defect. |
> [!IMPORTANT]
> **Requirements Gap vs. Coding Defect Protocol:**
> If a test failure is caused by an incomplete, ambiguous, or contradictory requirement rather than an implementation coding mistake, do NOT patch code silently. Halt and invoke `/up-change-request-impact` to compute the change blast radius and obtain stakeholder disposition via a formal Change Request (`CR-xxx`).
---
## 6. Manual QA Sign-Off Checklist for Gate 14.1
Before recommending Gate 14.1 closure for Iteration 01, the QA Lead must certify:
- [ ] All 32 test cases in [`Iteration01_Authentication_and_Session_Governance_Complete_Manual_Testcases.xlsx`](../workbooks/Iteration01_Authentication_and_Session_Governance_Complete_Manual_Testcases.xlsx) have been executed in Staging.
- [ ] All 6 step-by-step testing protocols in this guide passed with zero P0 or P1 open defects.
- [ ] Segregation-of-duties invariants (SoD 1, 2, and 3) verified with negative evidence logged.
- [ ] Session termination verified: ended tokens cannot access protected endpoints.
- [ ] Bruno API collection runs clean with 100% assertion pass rate.
- [ ] Automated test coverage meets tiered budget ($\ge 95\%$ domain/FSM, $\ge 90\%$ adapter, $\ge 80\%$ frontend).

View File

@ -30,3 +30,16 @@ Executed Stage 11 (`up-wireframe-spec`) and Stage 12 (`up-test-model-generate`)
4. Authored `test_traceability_matrix.md` and updated `regression_test_cases.md` to v1.2.0.
5. Ran `scripts/verify_traceability_gates.py --all`: Gates 5.1, 9.1, and 14.1 all passed with 0 Critical issues.
6. Recorded Checkpoint 017 (`checkpoint-017-stage-11-12-wireframes-test-models.md`), updated `checkpoint_index.md` and `master_context.md`. Requirements set to `In Construction`. Ready for Stage 13 code generation (`/up-code-generate`).
## 2026-10-12T04:46:11Z — User
Proceed but also ensure you generate the Manual Testing guide required by the QA
## 2026-10-12T04:46:11Z — Assistant — Action summary
Generated the comprehensive, production-grade Manual Testing Guide for QA at `04_generated_documentation/07_test_design/manual_qa/iteration-01/MANUAL_TESTING_GUIDE.md`:
1. Established test topologies (Docker Compose live Keycloak vs. deterministic mock `sandbox/identity_mock.py`).
2. Configured 11 disposable QA personas with exact credentials and role-specific permissions/constraints (`admin@alpha.com`, `buyer@alpha.com`, `qc@alpha.com`, etc.).
3. Authored 6 step-by-step test execution protocols covering OIDC PKCE login, boundary/expiry testing, role authorization, segregation of duties enforcement, session invalidation on logout, and offline mock execution.
4. Defined defect severity ratings, requirements gap escalation procedure (`CR-xxx`), and QA sign-off criteria for Gate 14.1.
5. Re-verified Gate 14.1 with zero critical issues. Ready to initiate Stage 13 wave-based code generation (`up-code-generate`).