6.8 KiB
World-Class Assessment Load Test - Usage Guide
Overview
This load test script runs the 100% verified complete assessment flow for multiple students:
- Smart login (Excel password → Admin@123 fallback)
- Password reset if needed
- Profile completion if needed
- Complete ONE domain assessment (all questions)
- Submit assessment and handle feedback
Key Features
✅ CSV Range Support: Run specific student ranges (perfect for multi-device execution) ✅ Real-time Monitoring: Live metrics every N students ✅ 100% Verified Flow: Uses only tested, reliable components ✅ Transparent Backend Analysis: Comprehensive metrics for server performance ✅ Multi-Device Ready: Each device can run different ranges
Usage
Basic Command
cd /home/tech4biz/work/CP_Front_Automation_Test
source venv/bin/activate
python tests/load_tests/test_generic_load_assessments.py \
--csv students_with_passwords_2025-12-12T13-19-32.csv \
--start 0 \
--end 100 \
--workers 100 \
--headless \
--metrics-interval 10
Multi-Device Execution
Device 1 (Students 0-99):
python tests/load_tests/test_generic_load_assessments.py \
--csv students_with_passwords_2025-12-12T13-19-32.csv \
--start 0 \
--end 100 \
--workers 100 \
--headless \
--metrics-interval 10
Device 2 (Students 100-199):
python tests/load_tests/test_generic_load_assessments.py \
--csv students_with_passwords_2025-12-12T13-19-32.csv \
--start 100 \
--end 200 \
--workers 100 \
--headless \
--metrics-interval 10
Device 3 (Students 200-299):
python tests/load_tests/test_generic_load_assessments.py \
--csv students_with_passwords_2025-12-12T13-19-32.csv \
--start 200 \
--end 300 \
--workers 100 \
--headless \
--metrics-interval 10
Device 4 (Students 300-399):
python tests/load_tests/test_generic_load_assessments.py \
--csv students_with_passwords_2025-12-12T13-19-32.csv \
--start 300 \
--end 400 \
--workers 100 \
--headless \
--metrics-interval 10
Device 5 (Students 400-500):
python tests/load_tests/test_generic_load_assessments.py \
--csv students_with_passwords_2025-12-12T13-19-32.csv \
--start 400 \
--end 500 \
--workers 100 \
--headless \
--metrics-interval 10
Arguments
| Argument | Description | Default | Example |
|---|---|---|---|
--csv |
Path to CSV file (required) | - | students_with_passwords_2025-12-12T13-19-32.csv |
--start |
Start index (0-based, excluding header) | 0 | 0, 100, 200 |
--end |
End index (exclusive, None = all remaining) | None | 100, 200, 500 |
--workers |
Max concurrent workers | All students | 100, 200, 500 |
--headless |
Run in headless mode | True | (flag) |
--visible |
Run in visible mode (overrides headless) | False | (flag) |
--metrics-interval |
Print metrics every N students | 10 | 5, 10, 20 |
CSV Format
The CSV must have these columns (case-insensitive):
Student CPIDorstudent_cpidorcpidorCPID(required)PasswordorpasswordorPASSWORD(optional, will use Admin@123 if missing)First Name(optional, for display)Last Name(optional, for display)
Real-Time Metrics
The script prints comprehensive metrics every N students (configurable):
📊 REAL-TIME METRICS
================================================================================
⏱️ Elapsed Time: 125.3s
✅ Completed: 50
❌ Failed: 2
📈 Success Rate: 96.2%
⚡ Rate: 0.40 students/sec
⏳ Avg Duration: 245.6s
❓ Avg Questions: 12.3
📊 Total Questions: 615
📋 STEP METRICS:
login : 100.0% success, 2.1s avg
password_reset : 95.0% success, 3.5s avg
profile_completion : 90.0% success, 15.2s avg
assessment : 96.0% success, 220.5s avg
================================================================================
Output Files
Results are saved to:
reports/load_tests/load_test_Complete_Assessment_Flow_{N}users_{timestamp}.json
Best Practices
-
Multi-Device Setup: Divide students evenly across devices
- 500 students = 5 devices × 100 students each
- 1000 students = 10 devices × 100 students each
-
Concurrency: Start with
--workersequal to number of students in range- For 100 students:
--workers 100 - Monitor system resources and adjust if needed
- For 100 students:
-
Headless Mode: Always use
--headlessfor load testing- Much faster and more stable
- Lower resource usage
-
Metrics Interval: Use
--metrics-interval 10for frequent updates- Adjust based on test duration
- Smaller intervals for shorter tests
-
Range Validation:
--start 0means first student (after header)--end 100means up to (but not including) index 100- So
--start 0 --end 100runs students at indices 0-99
Example: Running All 500 Students on 5 Devices
Device 1:
python tests/load_tests/test_generic_load_assessments.py \
--csv students_with_passwords_2025-12-12T13-19-32.csv \
--start 0 --end 100 --workers 100 --headless
Device 2:
python tests/load_tests/test_generic_load_assessments.py \
--csv students_with_passwords_2025-12-12T13-19-32.csv \
--start 100 --end 200 --workers 100 --headless
Device 3:
python tests/load_tests/test_generic_load_assessments.py \
--csv students_with_passwords_2025-12-12T13-19-32.csv \
--start 200 --end 300 --workers 100 --headless
Device 4:
python tests/load_tests/test_generic_load_assessments.py \
--csv students_with_passwords_2025-12-12T13-19-32.csv \
--start 300 --end 400 --workers 100 --headless
Device 5:
python tests/load_tests/test_generic_load_assessments.py \
--csv students_with_passwords_2025-12-12T13-19-32.csv \
--start 400 --end 500 --workers 100 --headless
Troubleshooting
Issue: "No students loaded"
- Check CSV path is correct
- Verify
--startand--endare valid - Ensure CSV has
Student CPIDcolumn
Issue: High failure rate
- Reduce
--workers(too many concurrent browsers) - Check system resources (RAM, CPU)
- Verify backend is handling load
Issue: Slow execution
- Use
--headlessmode - Reduce
--metrics-interval(less frequent printing) - Check network latency
Notes
- Password Strategy: Excel password tried first, then Admin@123 fallback
- Assessment Flow: Completes ONE domain (first unlocked domain)
- Question Types: Handles all 5 question types automatically
- Error Handling: Robust retry logic for transient failures
- Progress Tracking: Real-time metrics show exactly what's happening