Testing Guide
Purpose and Scope
This document provides guidance on testing the TalentSync platform, including manual testing procedures, API endpoint validation, and recommended testing strategies. For information about local development setup, see Local Development Setup. For API endpoint specifications, see API Documentation.
Current Testing Infrastructure
Testing Framework Status
The TalentSync codebase currently relies primarily on manual testing and validation rather than automated test suites. This section documents the available testing mechanisms and recommended practices.
Frontend Testing:
- No automated test framework currently configured in frontend/package.json1-98
- ESLint configured for code quality checks via
npm run lint - TypeScript provides compile-time type checking
Backend Testing:
- No automated test framework currently configured in backend/app/main.py1-149
- FastAPI's built-in interactive documentation (
/docsand/redoc) provides manual API testing
Available Validation Tools:
| Component | Tool | Purpose |
|---|---|---|
| Frontend Code Quality | ESLint | Syntax and style checking |
| Frontend Type Safety | TypeScript | Static type validation |
| Backend API Documentation | FastAPI Swagger UI | Interactive endpoint testing |
| Database Schema | Prisma | Schema validation and migrations |
| PWA Functionality | Browser DevTools | Service worker and manifest validation |
Manual Testing Procedures
Backend API Testing
Using FastAPI Interactive Documentation
The FastAPI backend provides automatic interactive API documentation accessible at two endpoints:
- Swagger UI:
http://localhost:8000/docs - ReDoc:
http://localhost:8000/redoc
Testing Workflow:
- Start the backend server (see Local Development Setup)
- Navigate to
http://localhost:8000/docs - Expand any endpoint to view parameters and request/response schemas
- Click "Try it out" to execute requests
- Review response status codes and JSON payloads
Testing Individual API Routes
Resume Analysis Service:
- Endpoint:
POST /api/v1/analyze_resume - Router: backend/app/main.py102-108
- Test with: PDF, DOCX, or TXT resume files
- Expected: JSON response with comprehensive analysis data
Cold Mail Generator:
- v1 Endpoint:
POST /api/v1/cold_mail(file-based) - v2 Endpoint:
POST /api/v2/cold_mail(text-based) - Routers: backend/app/main.py62-84
- Test with: Resume text/file + recipient details
- Expected: Generated email content
ATS Evaluation:
- v1 Endpoint:
POST /api/v1/ats(file-based) - v2 Endpoint:
POST /api/v2/ats(text-based) - Routers: backend/app/main.py118-132
- Test with: Resume + job description
- Expected: ATS score and improvement suggestions
Hiring Assistant:
- v1 Endpoint:
POST /api/v1/hiring_assistant(file-based) - v2 Endpoint:
POST /api/v2/hiring_assistant(text-based) - Routers: backend/app/main.py86-100
- Test with: Resume + interview question
- Expected: Generated answer framework
Frontend Testing
Browser-Based Manual Testing
Development Environment Testing:
Production Build Testing:
Key User Flows to Test
Authentication Flow:
- Navigate to
/auth - Test registration with email verification
- Test login with credentials
- Test OAuth (Google/GitHub)
- Test password reset flow
- Verify role selection after first login
Resume Analysis Flow:
- Login as job seeker
- Navigate to
/dashboard/seeker - Upload resume (PDF/DOCX/TXT)
- Enter custom name
- Verify analysis appears in 4-8 seconds
- Check detailed analysis page
- Verify data persists in localStorage
Cold Mail Generation Flow:
- Complete resume analysis first
- Navigate to
/dashboard/cold-mail - Select analyzed resume
- Enter recipient details
- Verify email generation
- Test edit functionality
Database Testing
Prisma Schema Validation
Check schema integrity:
Generate Prisma Client:
Run migrations:
Seed database with test data:
The seed script is defined in frontend/package.json14-16 and executes the seeding logic defined in the Prisma seed configuration.
Database State Inspection
Access Prisma Studio:
This opens a web-based GUI at http://localhost:5555 for inspecting and manipulating database records.
PWA Testing
Service Worker Validation
Testing in Development: PWA features are disabled in development mode as configured in frontend/next.config.js5:
Testing in Production:
- Build production bundle:
bun run build - Serve production build:
bun run start - Open browser DevTools → Application tab
- Verify service worker registration under "Service Workers"
- Check manifest.json under "Manifest"
Offline Functionality Testing:
- Load application in browser
- Open DevTools → Network tab
- Check "Offline" checkbox
- Navigate between pages
- Verify cached resources load successfully
Cache Strategy Validation:
API Endpoint Testing Reference
Endpoint Testing Matrix
| Service | Method | v1 Endpoint | v2 Endpoint | Input Type | Test File |
|---|---|---|---|---|---|
| Resume Analysis | POST | /api/v1/analyze_resume |
/api/v2/analyze_resume |
File / Text | sample_resume.pdf |
| Cold Mail | POST | /api/v1/cold_mail |
/api/v2/cold_mail |
File / Text | sample_resume.pdf + recipient.json |
| Hiring Assistant | POST | /api/v1/hiring_assistant |
/api/v2/hiring_assistant |
File / Text | sample_resume.pdf + question.txt |
| ATS Evaluation | POST | /api/v1/ats |
/api/v2/ats |
File / Text | sample_resume.pdf + job_description.txt |
| Tailored Resume | POST | /api/v1/tailored_resume |
/api/v2/tailored_resume |
File / Text | sample_resume.pdf + job_details.json |
| LinkedIn Profile | POST | /api/v1/linkedin_profile |
N/A | Resume Data | resume_data.json |
| LinkedIn Posts | POST | /api/v1/linkedin_posts |
N/A | Profile Data | profile_data.json |
| Tips | GET | /api/v1/tips |
N/A | Query Params | N/A |
| Database | Various | /api/v1/* |
N/A | Varies | N/A |
Testing with cURL
Resume Analysis:
Cold Mail Generation (v2):
ATS Evaluation:
Integration Testing Strategies
Testing Data Flow Between Components
Integration Test Scenarios:
-
End-to-End Resume Analysis:
- Upload file through frontend
- Verify backend processing
- Check database persistence
- Confirm localStorage caching
- Validate UI display
-
Cross-Feature Integration:
- Complete resume analysis
- Use analysis ID in cold mail generation
- Verify data consistency
- Test navigation between features
-
Authentication Flow:
- Register new user
- Verify email
- Select role
- Access protected routes
- Test middleware enforcement
Environment-Specific Testing
Development Environment
Configuration:
- Frontend:
http://localhost:3000 - Backend:
http://localhost:8000 - Database: Local PostgreSQL
- PWA: Disabled (frontend/next.config.js5)
Testing Focus:
- Rapid iteration
- Hot module reloading
- Debug logging enabled
- CORS configured for local development
Production Environment
Configuration:
- Frontend: Production Next.js build
- Backend: Uvicorn with production settings
- Database: Production PostgreSQL
- PWA: Enabled (frontend/next.config.js2-6)
Testing Focus:
- Performance under load
- Service worker caching
- Build optimization
- Error handling
Build Validation:
Recommended Testing Approach
For Future Test Implementation
Given the current state of the codebase, the following testing frameworks and strategies are recommended:
Frontend Testing:
- Framework: Vitest + React Testing Library
- E2E: Playwright or Cypress
- Component Testing: Storybook
Backend Testing:
- Framework: pytest + pytest-asyncio
- API Testing: FastAPI TestClient
- Integration: pytest with test database
Suggested Test Structure:
frontend/
├── __tests__/
│ ├── components/
│ ├── pages/
│ └── integration/
└── vitest.config.ts
backend/
├── tests/
│ ├── unit/
│ ├── integration/
│ └── conftest.py
└── pytest.ini
Priority Testing Areas
-
Authentication & Authorization (High)
- User registration and email verification
- OAuth provider integration
- Role-based access control
- Session management
-
Resume Analysis Pipeline (High)
- File upload and parsing
- ML classification accuracy
- LLM response validation
- Database persistence
-
AI Service Integrations (Medium)
- Google Gemini API calls
- Tavily search results
- Jina AI web content extraction
- Error handling for API failures
-
Data Integrity (High)
- Database schema constraints
- Data validation (Pydantic/Zod)
- Foreign key relationships
- Cascade deletions
Error Testing & Validation
Common Error Scenarios
Backend Errors:
| Error Type | Trigger | Expected Behavior |
|---|---|---|
| File Type Invalid | Upload .exe file | 400 Bad Request with error message |
| File Size Exceeded | Upload 50MB file | 413 Payload Too Large |
| Missing API Key | Invalid GEMINI_API_KEY |
500 Internal Server Error |
| Database Connection | PostgreSQL down | 503 Service Unavailable |
| Rate Limiting | Exceed API quota | 429 Too Many Requests |
Frontend Errors:
| Error Type | Trigger | Expected Behavior |
|---|---|---|
| Network Failure | Disconnect internet | Toast notification + retry option |
| Invalid Form Data | Submit empty fields | Form validation error messages |
| Unauthorized Access | Access protected route | Redirect to /auth |
| Session Expired | Token expiration | Automatic logout + redirect |
Error Handling Validation
Test with Invalid Inputs:
Performance Testing
Load Testing Considerations
Backend Performance Metrics:
- Resume analysis: Target < 8 seconds
- Cold mail generation: Target < 5 seconds
- ATS evaluation: Target < 10 seconds (with web search)
- Database queries: Target < 100ms
Monitoring Points:
- FastAPI request duration
- LLM API response time (Gemini)
- Database query performance
- File upload/processing time
Basic Load Test (using Apache Bench):
Browser Performance Testing
Lighthouse Audits:
- Open Chrome DevTools
- Navigate to Lighthouse tab
- Select categories (Performance, PWA, Accessibility)
- Generate report
- Review metrics:
- First Contentful Paint
- Time to Interactive
- Total Blocking Time
- PWA score
Debugging and Troubleshooting
Backend Debugging
Enable Debug Logging:
Check API Health:
Inspect Database Connection:
Frontend Debugging
Next.js Debug Mode:
Check Build Issues:
Inspect Network Requests:
- Open Browser DevTools → Network tab
- Filter by API calls (
/api/) - Check request/response payloads
- Verify CORS headers
Testing Checklist
Pre-Deployment Validation
Backend:
- All API endpoints return expected status codes
- File upload limits enforced (check backend/app/main.py1-16)
- CORS headers configured correctly
- Database migrations applied
- Environment variables loaded
- External API keys valid (Gemini, Tavily, Jina)
- Error responses include helpful messages
Frontend:
- Production build completes without errors
- All pages render correctly
- Authentication flow works end-to-end
- Protected routes redirect properly
- PWA manifest generated
- Service worker registers successfully
- Images optimized (check frontend/next.config.js13-16)
- PostHog analytics tracking
- Toast notifications display correctly
Database:
- Schema matches Prisma models
- Migrations applied successfully
- Foreign key constraints enforced
- Indexes created for performance
- Seed data populated (if applicable)
Integration:
- Frontend can reach backend API
- Database connections stable
- File uploads complete successfully
- localStorage persistence works
- Cross-feature data flow validated