3.5 KiB
3.5 KiB
Custom URL Usage Guide
🎯 Overview
The load test script now supports a --url argument to use any frontend URL dynamically.
📝 Usage
Basic Usage
# Use default URL from config (localhost:3983 or live)
python3 tests/load_tests/test_generic_load_assessments.py \
--csv students_with_passwords_2025-12-15T10-49-08_01.csv \
--start 0 --end 1 --workers 1 --headless
Custom URL Usage
# Use custom local URL
python3 tests/load_tests/test_generic_load_assessments.py \
--csv students_with_passwords_2025-12-15T10-49-08_01.csv \
--start 0 --end 1 --workers 1 --headless \
--url http://localhost:3983
# Use custom port
python3 tests/load_tests/test_generic_load_assessments.py \
--csv students_with_passwords_2025-12-15T10-49-08_01.csv \
--start 0 --end 1 --workers 1 --headless \
--url http://localhost:5000
# Use live/staging URL
python3 tests/load_tests/test_generic_load_assessments.py \
--csv students_with_passwords_2025-12-15T10-49-08_01.csv \
--start 0 --end 1 --workers 1 --headless \
--url https://cognitiveprism.tech4bizsolutions.com
# Use any custom URL
python3 tests/load_tests/test_generic_load_assessments.py \
--csv students_with_passwords_2025-12-15T10-49-08_01.csv \
--start 0 --end 100 --workers 30 --headless \
--url https://staging.example.com
🔧 How It Works
- URL Override: When
--urlis provided, it overridesBASE_URLinconfig.config - Derived URLs: Automatically updates:
LOGIN_URL:{url}/DASHBOARD_URL:{url}/student/dashboardASSESSMENTS_URL:{url}/assessmentsPROFILE_EDITOR_URL:{url}/student/profile-builder
- Page Objects: All page objects use the updated URLs when instantiated
📋 Examples
Example 1: Local Development
python3 tests/load_tests/test_generic_load_assessments.py \
--csv students.csv \
--start 0 --end 10 \
--workers 5 \
--headless \
--url http://localhost:3983
Example 2: Staging Environment
python3 tests/load_tests/test_generic_load_assessments.py \
--csv students.csv \
--start 0 --end 100 \
--workers 30 \
--headless \
--url https://staging.cognitiveprism.com
Example 3: Production (with visible browsers for debugging)
python3 tests/load_tests/test_generic_load_assessments.py \
--csv students.csv \
--start 0 --end 1 \
--workers 1 \
--visible \
--url https://cognitiveprism.tech4bizsolutions.com
⚙️ URL Format
- With protocol:
http://localhost:3983orhttps://example.com - Trailing slash: Automatically removed (both
http://localhost:3983/andhttp://localhost:3983work) - Port: Can specify any port (e.g.,
http://localhost:5000)
🔍 Verification
When you run the script, it will print:
🌐 Using custom URL: {your_url}if--urlis provided🌐 Using default URL: {default_url}if--urlis not provided
📝 Notes
- The URL override happens before page objects are instantiated
- All page objects will use the custom URL automatically
- No need to modify config files or environment variables
- Works with all existing functionality (login, password reset, profile, assessments, etc.)
🚀 Quick Reference
# Full command with all options
python3 tests/load_tests/test_generic_load_assessments.py \
--csv <csv_file> \
--start <start_index> \
--end <end_index> \
--workers <num_workers> \
--headless \
--url <custom_url> \
--metrics-interval <interval>
Status: ✅ Ready to Use