// 300초 동안 1초에 10명의 새로운 virtual user가 생성됨
phases:
- duration: 300
arrivalRate: 10
name: Warm up phase
duration
- 시나리오를 실행할 시간
arrivalRate
- 1초당 실행할 횟수
⇒ duration
X arrivalRate
= 더미 클라이언트의 개수
virtual user
virtual user
는 테스트 시나리오 중 하나를 택하여 끝까지 실행. duration은 모든 virtual user들이 테스트 시나리오를 완료하는데 걸리는 시간을 설정해놓은 것scenarios:
- name: My Socket.IO test
engine: socketio # Enable the Socket.IO engine
flow:
- emit:
channel: "echo"
data: "Hello world!"
emit
emit
action이 제공하는 특성들
channel
- the name of Socket.IO channel to emit an eventdata
- data to emitnamespace
- optional namespace to use for emitting the eventSocket.IO acknowledgements & Response Validation
response
- Optional object if you want to wait for a response
channel
- The name of the channel where the response is receiveddata
- The data to verify is in the response.acknowledge
- Optional object if you want to wait for an acknowledgement
data
- Match the response exactly to the value providedmatch
- Match the response with a JSONPath expression. This attribute expects an object with two attributes:
json
- The part of the response to compare.value
- The expected value.Ex 1) Emit an event & validate a response
config:
target: "<https://socketio.test/>"
phases:
- duration: 60
arrivalRate: 25
scenarios:
- name: "Emit an event"
engine: socketio
flow:
- emit:
channel: "echo"
data: "Hello from Artillery"
response:
channel: "echoResponse"
data: "Hello from Artillery"
Ex 2) Emit an event & validate an acknowledgement
config:
target: "<https://socketio.test/>"
phases:
- duration: 60
arrivalRate: 25
scenarios:
- name: "Emit and validate acknowledgement"
engine: socketio
flow:
- emit:
channel: "userDetails"
acknowledge:
match:
json: "$.0.name"
value: "Artillery"
Ex 3) Mixing in HTTP Actions
config:
target: "<http://lab.artillery.io>"
scenarios:
- engine: "socketio"
flow:
- get:
url: "/movies/10"
capture:
- json: "$.title"
as: "title"
- json: "$.genre"
as: "genre"
- log: "Emitting captured values: {{ title }}, {{ genre }}"
- emit:
channel: "echo"
data: "{{title}}"
# validate the received response
response:
channel: "echoResponse"
data: "{{title}}"
- emit:
channel: "echo"
data: "{{genre}}"
response:
channel: "echoResponse"
data: "{{genre}}"
- think: 1
- emit:
channel: "echo"
data: "do not care about the response"
- emit:
channel: "echo"
data: "still do not care about the response"
- think: 1