0% found this document useful (0 votes)
4K views5 pages

Artillery Handson

The document provides instructions for using Artillery to perform load testing on the reqres API, including creating virtual users to make GET, POST, and PUT requests over specified durations and arrival rates. Examples are given for performing a single request, ramping arrival rates over time, capturing response values, using inline and CSV data for payloads, and implementing for loops. The goal is to test different usage patterns and load scenarios against the reqres API using Artillery.

Uploaded by

Senthil Lakshmi
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
4K views5 pages

Artillery Handson

The document provides instructions for using Artillery to perform load testing on the reqres API, including creating virtual users to make GET, POST, and PUT requests over specified durations and arrival rates. Examples are given for performing a single request, ramping arrival rates over time, capturing response values, using inline and CSV data for payloads, and implementing for loops. The goal is to test different usage patterns and load scenarios against the reqres API using Artillery.

Uploaded by

Senthil Lakshmi
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
You are on page 1/ 5

Create 20 virtual users every second on an average for 1 minutes which will perform

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.

duration should be 1 minute.

virtual users should be 20

user id should be 3.

config:
target: 'https://reqres.in'
phases:
- duration: 60
arrivalRate: 20
scenarios:
- flow:
- get:
url: "/api/users/3"

artillery run sample.yml -o output.txt

artillery run test.yml -o output.txt

config:
target: 'https://reqres.in'
phases:
- duration: 120
arrivalRate: 10
rampTo: 20
scenarios:
- flow:
- post:
url: "/api/users"
json:
name: "Harley"
job: "Software Engineer"

artillery run test.yml -o output.txt


Create 20 virtual users in 60 seconds( one every 3 seconds on average) to perform
PUT request for updating name and job for id 2.

config:
target: 'https://reqres.in'
phases:
- duration: 60
arrivalRate: 20
scenarios:
- flow:
- put:
url: "/api/users/2"
json:
name: "NewName"
job: "SE"

artillery run test.yml -o output.txt

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 }}"

artillery run test.yml -o output.txt

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"

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy