CP_AUTOMATION/scripts/LOAD_TEST_README.md
2025-12-12 19:54:54 +05:30

6.0 KiB

Load Testing Script - End-to-End Assessment Flow

Overview

This script performs load testing by running multiple students through the complete end-to-end flow simultaneously:

  1. Login (with smart password handling)
  2. Password Reset (if needed)
  3. Profile Completion (if needed)
  4. Complete ONE Domain Assessment (100% reliable flow)

Prerequisites

  • 100% Working Flow: Only uses flows we're 100% confident about
  • Single Domain Assessment: Uses the most reliable assessment flow
  • All 5 Question Types: Handles Multiple Choice, True/False, Rating Scale, Open Ended, Matrix
  • Error Handling: Robust error handling and recovery
  • Randomized Waits: Realistic timing for load testing

Usage

Basic Usage

python scripts/load_test_e2e_assessment.py --students 10 --csv students.csv

With Custom Concurrency

python scripts/load_test_e2e_assessment.py --students 50 --csv students.csv --concurrent 10

Visible Mode (for debugging)

python scripts/load_test_e2e_assessment.py --students 5 --csv students.csv --no-headless

Arguments

Argument Required Default Description
--students Yes - Number of students to test
--csv Yes - Path to CSV file with student data
--concurrent No 5 Number of concurrent students
--headless No True Run in headless mode
--no-headless No - Run in visible mode (for debugging)

CSV Format

The CSV file should contain student data with at least:

  • cpid or CPID column (or first column)
  • password column (for initial password)
  • Other student data (first_name, last_name, etc.) for profile completion

Example:

cpid,password,first_name,last_name,date_of_birth
SC309TB0284,VXa$Ai5kj4rV,John,Doe,2008-01-15
BAR210A010D,Admin@123,Jane,Smith,2007-05-20

What It Does

For Each Student:

  1. Setup WebDriver - Creates a new browser instance
  2. Login - Logs in with smart password handling (tries Excel password, then Admin@123)
  3. Password Reset - Resets password if needed (only if not already reset)
  4. Profile Completion - Completes profile to 100% if needed (only if incomplete)
  5. Navigate to Assessments - Goes to assessments page
  6. Start Assessment - Starts the first available assessment
  7. Select Domain - Selects the first unlocked domain
  8. Answer All Questions - Answers all questions in the domain (all 5 types)
  9. Submit Domain - Submits the domain assessment
  10. Provide Feedback - Provides domain feedback
  11. Cleanup - Closes browser instance

Output

The script provides:

  • Real-time progress updates
  • Success/failure status for each student
  • Duration tracking
  • Error reporting
  • Summary statistics

Example output:

🚀 Starting flow for: SC309TB0284
✅ Completed: SC309TB0284 (success) - 245.32s
🚀 Starting flow for: BAR210A010D
✅ Completed: BAR210A010D (success) - 198.76s

================================================================================
LOAD TEST SUMMARY
================================================================================
✅ Success: 8/10
❌ Failed: 2/10
⏭️  Skipped: 0/10
⏱️  Total Duration: 1205.45s
📊 Average per Student: 120.54s

Performance Considerations

  • Small Load (1-10 students): --concurrent 3-5
  • Medium Load (10-50 students): --concurrent 5-10
  • Large Load (50+ students): --concurrent 10-20

System Requirements

  • RAM: ~500MB per concurrent student
  • CPU: Multi-core recommended for concurrent execution
  • Network: Stable connection to backend server

Error Handling

The script handles:

  • Login failures
  • Password reset failures
  • Profile completion failures
  • Assessment navigation failures
  • Question answering failures
  • Network timeouts
  • Browser crashes

All errors are logged and reported in the summary.

Limitations

  • ⚠️ Single Domain Only: Completes only ONE domain per student (the most reliable flow)
  • ⚠️ No Multi-Domain: Does not complete all 6 domains (not yet 100% reliable)
  • ⚠️ No Final Feedback: Does not handle final feedback after all domains (not yet 100% reliable)

Future Enhancements

  • Multi-domain completion (when 100% reliable)
  • Final feedback handling (when 100% reliable)
  • Performance metrics collection
  • Backend response time tracking
  • Database query monitoring
  • Resource usage monitoring

Troubleshooting

"No students loaded from CSV"

  • Check CSV file path
  • Verify CSV has cpid or CPID column
  • Check file encoding (should be UTF-8)

"Driver setup failed"

  • Ensure Chrome browser is installed
  • Check ChromeDriver is in PATH
  • Verify Chrome version matches ChromeDriver version

"No assessments available"

  • Ensure student profile is 100% complete
  • Check if assessments are assigned to students
  • Verify environment (local vs live)

High failure rate

  • Reduce --concurrent value
  • Check backend server capacity
  • Verify network stability
  • Check system resources (RAM, CPU)

Example Commands

Test with 5 students (debugging)

python scripts/load_test_e2e_assessment.py --students 5 --csv students.csv --no-headless

Test with 20 students (medium load)

python scripts/load_test_e2e_assessment.py --students 20 --csv students.csv --concurrent 5

Test with 100 students (large load)

python scripts/load_test_e2e_assessment.py --students 100 --csv students.csv --concurrent 10

Notes

  • 100% Reliable Flow: Only uses flows we're 100% confident about
  • Single Domain: Completes one domain assessment per student
  • All Question Types: Handles all 5 question types automatically
  • Error Recovery: Robust error handling and recovery mechanisms
  • Realistic Timing: Uses randomized waits for realistic behavior

Status: READY FOR USE - All flows are 100% reliable and tested