Artillery Handson
Artillery Handson
the search for user id 3. Use reqres application as base URL and request URL.
Environment Customisation:
To install artillery click on the command npm install artillery now verify
artillery installation
using the command artillery dino
Create a sample.yml in the terminal and insert the script in sample.yml using vi
editor.
Task
reqres application should be base URL and request URL.
user id should be 3.
config:
target: 'https://reqres.in'
phases:
- duration: 60
arrivalRate: 20
scenarios:
- flow:
- get:
url: "/api/users/3"
config:
target: 'https://reqres.in'
phases:
- duration: 120
arrivalRate: 10
rampTo: 20
scenarios:
- flow:
- post:
url: "/api/users"
json:
name: "Harley"
job: "Software Engineer"
config:
target: 'https://reqres.in'
phases:
- duration: 60
arrivalRate: 20
scenarios:
- flow:
- put:
url: "/api/users/2"
json:
name: "NewName"
job: "SE"
Create ramp up arrival rate from 10 to 20 over 2 minutes for creating the user
account.
Define the variable request URL, name and job in the Inline variable. Use reqres
application as base URL and request URL.
config:
target: 'https://reqres.in'
phases:
- duration: 120
arrivalRate: 10
rampTo: 20
payload:
path: "./data.csv"
fields:
- "name"
- "job"
scenarios:
- flow:
- post:
url: "/api/users"
json:
name: "{{ name }}"
job: "{{ job }}"
Create 20 virtual users every second on an average for 2 minutes pass 10 seconds as
the pause time and call for ramp up arrival rate from 10 to 20 over 1 minutes.
Perform post request for registering.
config:
target: "https://reqres.in/"
phases:
- duration: 120
arrivalRate: 20
- pause: 10
- duration: 60
arrivalRate: 10
rampTo: 20
scenarios:
- flow:
- post:
url: "/api/users"
json:
name: "Harley"
job: "Software Engineer"
config:
target: 'https://reqres.in'
phases:
- duration: 120
arrivalRate: 10
rampTo: 20
payload:
path: "./data.csv"
fields:
- "name"
- "job"
scenarios:
- flow:
- post:
url: "/api/users"
json:
name: "{{ name }}"
job: "{{ job }}"
capture:
json: "$.id"
as: "id"
- log: "Id value: {{ id }}"
- get:
url: "/api/users/{{ id }}"
Create ramp up arrival rate from 10 to 20 over 1 minutes for creating the user
account. Define the variable request URL,
name and job in the Inline variable. Search the newly created user using ID. Use
reqres application as base URL and request URL.
config:
target: "https://reqres.in/"
phases:
- duration: 60
arrivalRate: 10
scenarios:
- flow:
- post:
url: "/api/users"
json:
name: "{{ name }}"
job: "{{ job }}"
capture:
json: "$.id"
as: "id"
- log: "Id value: {{ id }}"
config:
target: 'https://reqres.in'
phases:
- duration: 60
arrivalRate: 10
rampTo: 20
scenarios:
- flow:
- put:
url: "/api/users/2"
json:
name: "NewName"
job: "SE"
capture:
json: "$.id"
as: "id"
- get:
url: "/api/users/{{ id }}"
--For Loop
config:
target: 'https://reqres.in'
phases:
- duration: 60
arrivalRate: 20
scenarios:
- flow:
- loop:
- get:
url: "/api/users/3"
count: 10
-- For Debug
config:
target: 'https://reqres.in'
phases:
- duration: 60
arrivalRate: 10
scenarios:
- flow:
- post:
url: "/api/users"
json:
name: "Harley"
job: "Software Engineer"