Installation
- npm i -g artilleryInstall globally
- npm i artilleryInstall locally
- artillery versionCheck version
- artillery quickQuick test
Basic YAML Config
config:
target: "https://api.example.com"
phases:
- duration: 60
arrivalRate: 10
name: "Warm up"
- duration: 120
arrivalRate: 50
name: "Ramp up"
scenarios:
- name: "Get users"
flow:
- get:
url: "/users"
CLI Commands
- artillery run test.ymlRun test
- artillery run -o out.jsonSave results
- artillery report out.jsonGenerate HTML
- artillery quick -n 100Quick 100 req
- artillery dinoFun easter egg
Load Phases
- durationPhase length (sec)
- arrivalRateNew users/sec
- arrivalCountFixed user count
- rampToRamp to rate
- maxVusersMax virtual users
- pausePause duration
HTTP Actions
- get:GET request
- post:POST request
- put:PUT request
- delete:DELETE request
- patch:PATCH request
- think:Wait/pause
- log:Log message
Assertions (expect)
- statusCode: 200Check status
- contentType: jsonCheck type
- hasProperty: idCheck property
- equals:Exact match
- matchesRegexp:Regex match
POST Request with JSON
scenarios:
- name: "Create user"
flow:
- post:
url: "/api/users"
headers:
Content-Type: "application/json"
json:
username: "{{ $randomString() }}"
email: "{{ $randomEmail() }}"
capture:
- json: "$.id"
as: "userId"
Built-in Functions
- $randomString()Random string
- $randomNumber()Random number
- $randomEmail()Random email
- $uuid()Generate UUID
- $timestamp()Unix timestamp
Config Options
- payload:CSV data file
- variables:Global vars
- defaults:Default headers
- plugins:Load plugins
- ensure:Pass/fail conditions
Thresholds (ensure)
config:
ensure:
p95: 500 # p95 latency < 500ms
maxErrorRate: 1 # Max 1% errors
max: 2000 # Max latency < 2000ms