CoolFace
Apppublic

codedematrix/datacollection

sourceHugging Faceupdated 3mo agoView on Hugging Face
0likes
TESTING_FRAMEWORK.md452 linesDownload Raw Back to testing
1# NCA Data Collection System — Testing Framework2 3**Version:** 1.0  4**Last Updated:** 2026-06-16  5**System URL (Live):** https://codedematrix-datacollection.hf.space/  6**System URL (Local):** http://localhost:3000  7 8---9 10## Overview11 12This document covers two levels of testing:13 14| Level | Who runs it | What it checks |15|-------|-------------|----------------|16| **API Tests** | Developer / QA | All backend endpoints return correct data and enforce security rules |17| **User Acceptance Tests (UAT)** | NCA staff + Provider testers | The platform works correctly from a real user's perspective |18 19---20 21## Part A — Automated API Tests22 23### How It Works24 25The API test script (`testing/api_test.sh`) makes real HTTP calls to the system. It does not mock anything — it hits the actual running server and checks that:26- The right HTTP status codes come back27- Authentication and authorisation are enforced28- Role-based access control (RBAC) works (providers can't see other providers' data)29- Data is returned in the expected format30 31### Running Against Local Server32 33```bash34# Make sure both servers are running first35# Then run:36bash testing/api_test.sh37 38# Or explicitly:39bash testing/api_test.sh http://localhost:800040```41 42### Running Against Live Deployment43 44```bash45bash testing/api_test.sh https://codedematrix-datacollection.hf.space46```47 48### What the Script Tests49 50| Section | Endpoints Tested |51|---------|-----------------|52| Health Check | Server reachable |53| Authentication | Login, bad credentials, token, profile, unauthenticated rejection |54| Providers | List, search, filter by category, get single, RBAC |55| Submissions | List, search, filter by status, get single, RBAC |56| Compliance | List flags, filter by status, acknowledge a flag |57| Users | List users, RBAC (provider blocked) |58| Exports | CSV export endpoint |59| Audit | Audit log accessible to NCA only |60 61### Reading the Results62 63```64✓ PASS  GET /providers/ list (HTTP 200)65✗ FAIL  Provider RBAC on submissions66         Expected 403, got 20067– SKIP  Export test — Need provider ID from earlier tests68```69 70A full run with no failures looks like:71```72RESULTS73Passed:  2274Failed:  075Skipped: 276```77 78---79 80## Part B — User Acceptance Testing (UAT)81 82These tests are to be done by actual users in the browser. Each scenario has:83- A **role** (who logs in)84- **Steps** to follow85- **Expected result** (what should happen)86- A **pass/fail checkbox**87 88### Test Accounts89 90| Role | Email | Password |91|------|-------|----------|92| NCA Admin | admin@nca.org.gh | testpass123 |93| NCA Officer | officer.asante@nca.org.gh | testpass123 |94| Provider (Data Entry) | dataentry@vodafone.com.gh | testpass123 |95| Provider (Approver) | admin@vodafone.com.gh | testpass123 |96 97---98 99### Module 1: Authentication100 101#### UAT-001 — Login with valid credentials102- **Role:** Any103- **Steps:**104  1. Go to the system URL105  2. Enter a valid email and password from the table above106  3. Click Login107- **Expected:** Redirected to dashboard, name appears in the sidebar108- **Pass / Fail:** ___109 110#### UAT-002 — Login with wrong password111- **Role:** Any112- **Steps:**113  1. Enter a valid email but wrong password114  2. Click Login115- **Expected:** Error message shown, not logged in116- **Pass / Fail:** ___117 118#### UAT-003 — Logout119- **Role:** Any120- **Steps:**121  1. Log in successfully122  2. Click the logout button (bottom of sidebar)123- **Expected:** Returned to login page, cannot go back with browser Back button124- **Pass / Fail:** ___125 126---127 128### Module 2: Dashboard129 130#### UAT-004 — NCA Dashboard overview131- **Role:** NCA Admin or NCA Officer132- **Steps:**133  1. Log in134  2. View the Dashboard page135- **Expected:** See counts for submissions (by status), overdue submissions, active periods, recent compliance alerts136- **Pass / Fail:** ___137 138#### UAT-005 — Notification bell139- **Role:** NCA Admin140- **Steps:**141  1. Click the bell icon (top right)142- **Expected:** Dropdown shows overdue submissions, correction requests, pending approvals with counts143- **Pass / Fail:** ___144 145---146 147### Module 3: Providers148 149#### UAT-006 — View providers list150- **Role:** NCA Admin151- **Steps:**152  1. Click "Providers" in the sidebar153- **Expected:** Table of providers showing name, category, licence number, status154- **Pass / Fail:** ___155 156#### UAT-007 — Search providers157- **Role:** NCA Admin158- **Steps:**159  1. On the Providers page, type "Vodafone" in the search box160- **Expected:** List filters to show only Vodafone-related providers161- **Pass / Fail:** ___162 163#### UAT-008 — Filter by category164- **Role:** NCA Admin165- **Steps:**166  1. On the Providers page, select "Mobile Network Operator" from the category dropdown167- **Expected:** Only MNO providers are shown168- **Pass / Fail:** ___169 170#### UAT-009 — Provider detail page171- **Role:** NCA Admin172- **Steps:**173  1. Click on any provider in the list174- **Expected:** Provider detail page loads showing company info, submission history, compliance status175- **Pass / Fail:** ___176 177#### UAT-010 — Provider cannot see other providers178- **Role:** Provider (Data Entry)179- **Steps:**180  1. Log in as dataentry@vodafone.com.gh181  2. Click "Providers" or look for provider list182- **Expected:** Provider only sees their own organisation — no list of all providers183- **Pass / Fail:** ___184 185---186 187### Module 4: Submissions188 189#### UAT-011 — View all submissions (NCA)190- **Role:** NCA Officer191- **Steps:**192  1. Click "Submissions" in the sidebar193- **Expected:** Table of all provider submissions with status badges and due dates194- **Pass / Fail:** ___195 196#### UAT-012 — Search submissions197- **Role:** NCA Officer198- **Steps:**199  1. On Submissions page, type a provider name in the search box (e.g. "MTN")200- **Expected:** Results filter in real time, showing only matching submissions201- **Pass / Fail:** ___202 203#### UAT-013 — Filter submissions by status204- **Role:** NCA Officer205- **Steps:**206  1. Select "Draft" from the status filter dropdown on Submissions207- **Expected:** Only DRAFT submissions shown208- **Pass / Fail:** ___209 210#### UAT-014 — Start a submission (Provider)211- **Role:** Provider (Data Entry)212- **Steps:**213  1. Log in as dataentry@vodafone.com.gh214  2. Click on a form listed as "Not Started"215  3. Click "Start form"216- **Expected:** Form opens with sections listed on the left, first section active217- **Pass / Fail:** ___218 219#### UAT-015 — Fill in form fields220- **Role:** Provider (Data Entry)221- **Steps:**222  1. On an open form, fill in values for at least 3 required fields223  2. Click "Save progress"224- **Expected:** "Saved" confirmation appears briefly, no data loss on page reload225- **Pass / Fail:** ___226 227#### UAT-016 — Mark a field as Not Applicable228- **Role:** Provider (Data Entry)229- **Steps:**230  1. On an open form, find a required field231  2. In the status dropdown next to the field, select "Not Applicable"232  3. Enter an explanation233  4. Save234- **Expected:** Field clears, explanation box appears, saves successfully235- **Pass / Fail:** ___236 237#### UAT-017 — Navigate between sections238- **Role:** Provider (Data Entry)239- **Steps:**240  1. On an open form, click "Next" to move to section 2, then "Previous"241- **Expected:** Correct sections load, completion percentage updates in stepper on left242- **Pass / Fail:** ___243 244#### UAT-018 — Upload Excel backup245- **Role:** Provider (Data Entry)246- **Steps:**247  1. On an open form (DRAFT status), scroll to the "Excel Backup" panel at the bottom of any section248  2. Upload an .xlsx file (any Excel file)249- **Expected:** Upload progress shown, file listed under "Previous Uploads" after success250- **Pass / Fail:** ___251 252#### UAT-019 — Submit to Approver253- **Role:** Provider (Data Entry)254- **Steps:**255  1. Fill in all required fields in a form256  2. Click "Submit to Approver"257- **Expected:** Status changes to "Pending Approval", button disappears, form becomes read-only258- **Pass / Fail:** ___259 260#### UAT-020 — Approver reviews and submits to NCA261- **Role:** Provider (Approver)262- **Steps:**263  1. Log in as admin@vodafone.com.gh264  2. Find a submission in "Pending Approval" status265  3. Review it, then click "Submit to NCA"266- **Expected:** Status changes to "Submitted", NCA is notified267- **Pass / Fail:** ___268 269#### UAT-021 — NCA reviews a submission270- **Role:** NCA Officer271- **Steps:**272  1. Find a SUBMITTED submission273  2. Click Review274  3. Review values, then click Approve275- **Expected:** Submission moves to APPROVED status276- **Pass / Fail:** ___277 278#### UAT-022 — NCA requests a correction279- **Role:** NCA Officer280- **Steps:**281  1. Find a SUBMITTED submission282  2. Click Review283  3. Click "Request Correction" and add a note284- **Expected:** Submission moves to CORRECTION_REQUESTED, provider can see the note and edit again285- **Pass / Fail:** ___286 287---288 289### Module 5: Compliance290 291#### UAT-023 — View compliance flags (NCA)292- **Role:** NCA Admin293- **Steps:**294  1. Click "Compliance" in the sidebar295- **Expected:** List of OPEN/ACKNOWLEDGED flags showing provider name, missing field count, completion percentage bar296- **Pass / Fail:** ___297 298#### UAT-024 — Acknowledge a flag299- **Role:** NCA Admin300- **Steps:**301  1. On the Compliance page, find an OPEN flag302  2. Click "Acknowledge"303- **Expected:** Flag status changes to ACKNOWLEDGED immediately304- **Pass / Fail:** ___305 306#### UAT-025 — Resolve a flag307- **Role:** NCA Admin308- **Steps:**309  1. Find an ACKNOWLEDGED flag310  2. Click "Resolve"311- **Expected:** Flag disappears from the active list (status = RESOLVED)312- **Pass / Fail:** ___313 314#### UAT-026 — Generate compliance email315- **Role:** NCA Admin316- **Steps:**317  1. Find a MISSING_DATA flag318  2. Click "Email Provider"319- **Expected:** Email draft shown with provider's missing field count and details320- **Pass / Fail:** ___321 322#### UAT-027 — Provider sees own compliance alerts323- **Role:** Provider (Data Entry)324- **Steps:**325  1. Log in as dataentry@vodafone.com.gh326  2. View provider dashboard327- **Expected:** See only Vodafone's own compliance alerts and completion percentages — no other provider data328- **Pass / Fail:** ___329 330---331 332### Module 6: Users333 334#### UAT-028 — Create a new user335- **Role:** NCA Admin336- **Steps:**337  1. Click "Users" in the sidebar338  2. Click "+ New User"339  3. Fill in: name, email, password (12+ chars), role = NCA Officer340  4. Click "Create User"341- **Expected:** User appears in the table, can now log in with those credentials342- **Pass / Fail:** ___343 344#### UAT-029 — Deactivate a user345- **Role:** NCA Admin346- **Steps:**347  1. Find any active user in the Users table348  2. Click "Deactivate"349- **Expected:** User's row shows "Inactive" badge, user cannot log in350- **Pass / Fail:** ___351 352#### UAT-030 — Create a Provider user with organisation353- **Role:** NCA Admin354- **Steps:**355  1. New User form → set role to "Provider Data Entry"356  2. Select an organisation from the dropdown that appears357  3. Create user358- **Expected:** User created successfully and linked to that provider organisation359- **Pass / Fail:** ___360 361---362 363### Module 7: Exports364 365#### UAT-031 — Export submission data as CSV366- **Role:** NCA Admin or NCA Officer367- **Steps:**368  1. Click "Exports" in the sidebar369  2. Select a provider from the dropdown370  3. Click Export371- **Expected:** CSV file downloads with columns: submission_id, provider_name, period_name, form_code, field_name, value372- **Pass / Fail:** ___373 374#### UAT-032 — Exported CSV contains real values375- **Role:** NCA Admin376- **Steps:**377  1. Export CSV for Vodafone378  2. Open in Excel or Google Sheets379- **Expected:** Rows contain actual submitted data values, not empty cells380- **Pass / Fail:** ___381 382---383 384### Module 8: Access Control (Security)385 386#### UAT-033 — Provider cannot access NCA dashboard387- **Role:** Provider (Data Entry)388- **Steps:**389  1. Log in as provider390  2. Manually try to navigate to /dashboard or /users in the browser address bar391- **Expected:** Redirected away or access denied — cannot see NCA pages392- **Pass / Fail:** ___393 394#### UAT-034 — Provider cannot access other provider's submission395- **Role:** Provider (Data Entry) — Vodafone396- **Steps:**397  1. Log in as Vodafone provider398  2. Note the URL of a Vodafone submission, e.g. /provider/submissions/5399  3. Change the ID to a different number that belongs to another provider400- **Expected:** 403 forbidden or "not found" — cannot access another provider's submission401- **Pass / Fail:** ___402 403---404 405## UAT Sign-Off Sheet406 407To be completed after UAT is done:408 409| Module | Total Tests | Passed | Failed | Notes |410|--------|-------------|--------|--------|-------|411| Authentication | 3 | | | |412| Dashboard | 2 | | | |413| Providers | 5 | | | |414| Submissions | 9 | | | |415| Compliance | 5 | | | |416| Users | 3 | | | |417| Exports | 2 | | | |418| Access Control | 2 | | | |419| **TOTAL** | **31** | | | |420 421**Tested by:** ___________________________  422**Date:** ___________________________  423**System version / URL:** ___________________________  424**Overall result:** PASS / FAIL  425**Sign-off:** ___________________________  426 427---428 429## Known Limitations During Testing430 431| Item | Status | Notes |432|------|--------|-------|433| Email sending (SMTP) | Not configured | Email drafts generate but are not sent |434| Celery background tasks | Not running | Compliance flags must be run manually via `python manage.py flag_missing_data` |435| Database persistence | Resets on HF restart | Data is re-seeded automatically on each container start |436| File storage | Local disk only | Uploaded Excel files are stored in-container and lost on restart |437 438---439 440## Reporting a Bug441 442When a test fails, record:443 4441. **Test ID** (e.g. UAT-018)4452. **Steps you took** (exactly)4463. **What you expected**4474. **What actually happened** (screenshot if possible)4485. **Browser and device** (e.g. Chrome on Windows 11)4496. **URL** when the error occurred450 451Send bug reports to the development team with this information.452