cd Loadtesting-socket
npm install
npm start (this will start the server for chat application your can listen the app on Localhost:8080)
cd load-test
There you Can Find Two Files in That Folder
-
target:- Used For Setting the Socket Address (ws/wss) Type !!
-
Ensure:- Goes with to otpn max (fail if max response time exceeds 500ms) and maxErrorRate (fail if error rate exceeds 1%) !!
-
transports:- Here We Set Protocol So Be Set ["websocket"] For testing Socket !!
-
processor:- Here We Mention the File Name Where we Want tho load dynamic scenario !!
-
phases:- in this Optn We Have duration (time test Run's in Milliseconds), arrivalRate (onStart the User we Have), rampTo (Will ramp Up User gradually), name (Name For That Phase) !!
-
scenarios:- Here We Define The Flow For Test case !!
-
engine:- we Set engine To 'socketio' !!
-
flow:- Here we Set Whole Test Flow
-
function (load function from custom.js Which get's Dummy Data)
-
emit (Inside this we have Channel (Socket Channel) and Data (data to send in that event(channel)) otpn)
-
think (do nothing for 5 seconds, then disconnect) !!
artillery run -o makeResult.json SocketTesting.yaml
Once You Run test You Will Start Getting New User on localhost:8080 and The Load on socket will increase !!!