|
| 1 | +@echo off |
| 2 | +echo 🚀 Artillery Load Testing for Skill-Swap-Hub |
| 3 | +echo ============================================ |
| 4 | + |
| 5 | +REM Check if Artillery is installed |
| 6 | +where artillery >nul 2>nul |
| 7 | +if %ERRORLEVEL% NEQ 0 ( |
| 8 | + echo ❌ Artillery is not installed. Please install it first: |
| 9 | + echo npm install -g artillery |
| 10 | + pause |
| 11 | + exit /b 1 |
| 12 | +) |
| 13 | + |
| 14 | +REM Check if Next.js server is running |
| 15 | +powershell -Command "try { Invoke-WebRequest -Uri http://localhost:3000 -UseBasicParsing -ErrorAction Stop } catch { exit 1 }" >nul 2>nul |
| 16 | +if %ERRORLEVEL% NEQ 0 ( |
| 17 | + echo ❌ Next.js server is not running on localhost:3000 |
| 18 | + echo Please start your server first: npm run dev |
| 19 | + pause |
| 20 | + exit /b 1 |
| 21 | +) |
| 22 | + |
| 23 | +echo ✅ Server is running, starting load tests... |
| 24 | +echo. |
| 25 | + |
| 26 | +echo Select which test to run: |
| 27 | +echo 1^) Basic Load Test ^(recommended for first run^) |
| 28 | +echo 2^) Authentication Load Test |
| 29 | +echo 3^) Stress Test ^(find breaking point^) |
| 30 | +echo 4^) Run All Tests ^(this will take ~20 minutes^) |
| 31 | +echo. |
| 32 | + |
| 33 | +set /p choice=Enter your choice (1-4): |
| 34 | + |
| 35 | +if "%choice%"=="1" goto basic |
| 36 | +if "%choice%"=="2" goto auth |
| 37 | +if "%choice%"=="3" goto stress |
| 38 | +if "%choice%"=="4" goto all |
| 39 | +goto invalid |
| 40 | + |
| 41 | +:basic |
| 42 | +echo 📊 Running Basic Load Test... |
| 43 | +echo Started at: %date% %time% |
| 44 | +echo ---------------------------------------- |
| 45 | +artillery run load-tests\basic-load-test.yml |
| 46 | +echo ---------------------------------------- |
| 47 | +echo ✅ Basic Load Test completed at: %date% %time% |
| 48 | +goto end |
| 49 | + |
| 50 | +:auth |
| 51 | +echo 📊 Running Authentication Load Test... |
| 52 | +echo Started at: %date% %time% |
| 53 | +echo ---------------------------------------- |
| 54 | +artillery run load-tests\auth-load-test.yml |
| 55 | +echo ---------------------------------------- |
| 56 | +echo ✅ Authentication Load Test completed at: %date% %time% |
| 57 | +goto end |
| 58 | + |
| 59 | +:stress |
| 60 | +echo 📊 Running Stress Test... |
| 61 | +echo Started at: %date% %time% |
| 62 | +echo ---------------------------------------- |
| 63 | +artillery run load-tests\stress-test.yml |
| 64 | +echo ---------------------------------------- |
| 65 | +echo ✅ Stress Test completed at: %date% %time% |
| 66 | +goto end |
| 67 | + |
| 68 | +:all |
| 69 | +echo 🔥 Running all tests - this will take approximately 20 minutes... |
| 70 | +echo 📊 Running Basic Load Test... |
| 71 | +artillery run load-tests\basic-load-test.yml |
| 72 | +timeout /t 10 /nobreak >nul |
| 73 | +echo 📊 Running Authentication Load Test... |
| 74 | +artillery run load-tests\auth-load-test.yml |
| 75 | +timeout /t 10 /nobreak >nul |
| 76 | +echo 📊 Running Stress Test... |
| 77 | +artillery run load-tests\stress-test.yml |
| 78 | +echo 🎉 All tests completed! |
| 79 | +goto end |
| 80 | + |
| 81 | +:invalid |
| 82 | +echo ❌ Invalid choice. Exiting... |
| 83 | +pause |
| 84 | +exit /b 1 |
| 85 | + |
| 86 | +:end |
| 87 | +echo. |
| 88 | +echo 📈 Load testing completed! |
| 89 | +echo Check the results above for: |
| 90 | +echo - Response times ^(min, max, median, p95, p99^) |
| 91 | +echo - Request rates ^(req/sec^) |
| 92 | +echo - Error rates |
| 93 | +echo - Concurrent user handling capacity |
| 94 | +pause |
0 commit comments