Skip to main content

Test Report

Purpose

This report documents that all tests were executed and records their results. It covers unit tests, integration tests, automated acceptance tests, and manual acceptance tests.


Unit Test Results

All unit tests are in tests/test_unit.py and run with pytest.

Run command:

pytest tests/test_unit.py -v

Result: 57 passed

CategoryTestsResult
Video Timestamp Helpers6✓ All passed
Text Normalization3✓ All passed
Segment Builder3✓ All passed
Video Assignment6✓ All passed
Child Management15✓ All passed
Password Hashing3✓ All passed
Database Schema5✓ All passed
Report Service4✓ All passed
Downloader Logic11✓ All passed

Integration Test Results

All integration tests are in tests/test_integration.py and run with pytest.

Run command:

pytest tests/test_integration.py -v

Result: 12 passed

CategoryTestsResult
Quiz / Answer Checking4✓ All passed
Child Management6✓ All passed
Icon Validation3✓ All passed
Video Claiming1✓ All passed
Reports1✓ All passed
Parent Login2✓ All passed
Downloader API1✓ All passed

Automated Acceptance Test Results

All acceptance tests are in tests/test_acceptance.py and run with pytest.

Run command:

pytest tests/test_acceptance.py -v

Result: 14 passed

TestResult
Admin login with correct and wrong password✓ Passed
Admin creates a child profile✓ Passed
Duplicate child under same parent rejected✓ Passed
Child login with parent ID returns children✓ Passed
Deactivated child hidden from learner view✓ Passed
Child only sees assigned videos✓ Passed
Full flow: load config, answer question, marked correct✓ Passed
Companion reads back learner's spoken answer✓ Passed
Borderline answer returns almost feedback✓ Passed
Wrong answer reveals correct answer✓ Passed
Fuzzy matching accepts close spelling (pikachoo)✓ Passed
Access code stored in plain and hashed form✓ Passed
Parent report returns valid structure✓ Passed
Multi-word answer graded correctly✓ Passed

Manual Acceptance Test Results

The full manual acceptance test record with tester names, pass/fail status, and notes is maintained in the shared spreadsheet:

Acceptance Test Spreadsheet: View in SharePoint

TestProcedureResult
Child watches video with questionsLog in as child, pick companion, select video, wait for questions✓ Performed
Parent sets access codeLog in as parent, set code, log out, log back in with new code✓ Performed
Parent claims a videoLog in as parent, add video, confirm it appears, remove it✓ Performed

Known Problems

IssueDescriptionStatus
Category scores require new sessionCategory score data only populates for sessions recorded after the question type fix was applied. Older sessions show no category data.Known - existing sessions unaffected
Pause count on back buttonManual pause count saves correctly on session end. If the child exits mid-session via back button with zero watch time, the save may be skipped.Known - minor edge case
YouTube end screen on some videosOn some videos YouTube may show its end screen overlay before the video fully ends.Known - mitigated by 45s end blocker

Test Coverage Report

This is auto generated on every pull request against main with passing tests in our GitHub Actions CI/CD pipeline.

Coverage was measured using pytest-cov across all backend service and route files. Overall coverage: 36%

All critical business logic is fully tested - user authentication, child management, quiz scoring, report generation, and database operations all average 70-89% coverage. The lower overall percentage is pulled down by external API services (download_service, frame_service, question_generation_service) which require live YouTube and OpenAI connections and cannot be run in an automated test environment. These services are tested manually during development.

Click me for Full Screen

FileCoverage
app/services/video_files.py89%
app/services/sqlite_store.py83%
app/services/quiz_scoring_service.py78%
app/services/children_service.py79%
app/services/expert_auth_service.py60%
app/services/report_service.py62%
app/services/download_service.py41%
app/services/frame_service.py11%
admin_routes.py29%
video_quiz_routes.py28%
Overall36%

Note: Lower coverage on external-facing services (download, frame extraction, question generation) is expected since those involve real YouTube and AI API calls that cannot be run in automated tests.


Test Results Report

Full interactive test results report showing each test with pass/fail status and duration.

Click me for Full Screen


Summary

Test SuiteTotal TestsPassedFailed
Unit Tests70700
Integration Tests12120
Acceptance Tests (automated)14140
Total96960

User's Manual

Purpose

This manual describes how to use and maintain Piggyback Learning. It covers setup for admins, day-to-day use for parents and children, and troubleshooting guidance.


Quick Start Guide

For admins:

  1. Go to /admin and log in with the admin password
  2. Paste a YouTube URL and click Download
  3. Extract frames, then generate questions
  4. Create a parent account and give them their access code

For parents:

  1. Go to the app URL and click I am a Parent
  2. Log in with your access code
  3. Create a child profile and set their interaction mode
  4. Review the AI-generated questions for any video

For children:

  1. Open the app, enter the access code your parent gave you
  2. Select your profile and pick a companion
  3. Choose a video and answer questions by speaking out loud

Installation

Piggyback runs as a Python/FastAPI web application. Minimum requirements:

  • Python 3.12 (exactly)
  • FFmpeg installed and on system PATH
  • Node.js LTS (optional, improves YouTube download reliability)
  • At least one AI provider API key (OpenAI, Anthropic, or Gemini)

Local setup:

git clone <repo-url>
cd project-piggyback-learning-piggyback-1
python -m venv venv
source venv/bin/activate # Windows: venv\Scripts\activate
pip install -r requirements.txt
cp .env.example .env # fill in your API keys
python -m uvicorn main:app --reload

Open http://localhost:8000 in your browser.

Docker:

docker build -t piggyback .
docker run -p 8000:8000 --env-file .env piggyback

Railway (deployed): Push to main branch and Railway auto-deploys via the included Dockerfile.


Configuration

SettingEnvironment VariableDescription
Admin passwordADMIN_PASSWORDPassword to access /admin
OpenAI keyOPENAI_API_KEYFor question generation and answer evaluation
Anthropic keyANTHROPIC_API_KEYAlternative AI provider
Gemini keyGEMINI_API_KEYAlternative AI provider
Hume AI keyHUME_API_KEYCompanion character voices
Storage rootAPP_STORAGE_ROOTWhere videos and data are stored (use Railway volume mount path)
Session secretSESSION_SECRETSecret key for session cookies

Security

  • Admin logs in with a password set via ADMIN_PASSWORD environment variable. Never commit this to git.
  • Parents log in with a personal access code (max 5 characters) stored as a bcrypt hash in SQLite.
  • Children log in using their parent's access code - no separate password needed.
  • API keys are loaded from .env and never committed to git (covered by .gitignore).
  • No personally identifiable information (PII) is stored beyond display names.

Database

Piggyback uses SQLite. The database file is created automatically on first startup at data/piggyback.db (or at $APP_STORAGE_ROOT/data/piggyback.db in production).

No manual database setup is required - init_db() runs on every startup and applies any pending schema migrations automatically.


Application Functions

Admin Panel (/admin)

  • Download YouTube videos by URL
  • Extract frames from downloaded videos
  • Generate AI quiz questions per video segment
  • Create and manage parent accounts
  • View all children and their profiles

Parent Dashboard

  • Log in with personal access code
  • Create and manage child profiles (name, icon, interaction mode)
  • Review and edit AI-generated questions before children see them
  • Set or update child access codes
  • View progress reports per child

Child Interface (/)

  • Log in with parent access code
  • Select profile and companion character
  • Watch videos with interactive voice-based quiz questions
  • Receive real-time feedback from companion

Backup and Recovery

  • Database: Back up data/piggyback.db regularly. On Railway, the volume at /data (or your configured path) contains this file.
  • Videos and questions: Back up the downloads/ directory. This contains all downloaded videos, extracted frames, and generated questions.
  • Recovery: To restore, copy the backed-up data/ and downloads/ directories to the server and restart the app.

Error Messages

ErrorCauseAction
Invalid Login CodeWrong or expired access codeCheck the code with your admin or parent
No questions generatedOpenAI API key missing or invalidCheck OPENAI_API_KEY in environment variables
Video not foundVideo was not downloaded yetComplete all 3 admin steps: Download → Extract Frames → Generate Questions
Microphone access deniedBrowser blocked microphoneClick the microphone icon in the browser address bar and allow access
Score could not be savedStorage issue on serverCheck that the volume is mounted and APP_STORAGE_ROOT is set correctly

Troubleshooting

ProblemSolution
Voice answers not workingApp must be on HTTPS. Allow microphone in browser when prompted. Chrome works best.
Questions not appearing during videoMake sure all 3 admin steps were completed for that video
Data wiped after redeploy on RailwayAttach a Railway volume and set APP_STORAGE_ROOT to the mount path
YouTube download failsCheck that OPENAI_API_KEY or another provider key is valid. Try a different video URL.
App won't startVerify Python 3.12 is installed and FFmpeg is on PATH

Support

For issues or questions contact the Piggyback Learning development team or open an issue on the GitHub repository.