Test script:
/* eslint-disable @typescript-eslint/ban-ts-comment */
import { sleep } from "k6";
import http from "k6/http";
import { SharedArray } from "k6/data";
/* @ts-ignore */
import papaparse from "https://jslib.k6.io/papaparse/5.1.1/index.js";
/* @ts-ignore */
import { randomItem } from "https://jslib.k6.io/k6-utils/1.1.0/index.js";
const csvData = new SharedArray("Tokens data array", function () {
return papaparse.parse(open("hhh-users-dev.csv"), { header: true }).data;
});
const userToken = randomItem(csvData);
console.log("User Token", userToken.token);
const baseUrl = "https://test.vmo2digital.co.uk/";
const route = "mobile";
const serviceStatusUrl = `${baseUrl}${route}/servicestatus`;
const homeUrl = `${baseUrl}${route}/home`;
const customerUrl = `${baseUrl}${route}/customer`;
const ordersUrl = `${baseUrl}${route}/orders`;
export default () => {
const date = new Date().toISOString();
const params = {
headers: {
"Accept-Version": "1.x",
Authorization: userToken.token,
"DAPI-ChannelID": "HHH",
"DAPI-CorrelationID": "307909bf-b0d5-47aa-8ab6-c859246c66b3",
"DAPI-RequestID": "307909bf-b0d5-47aa-8ab6-c859246c66b4",
"DAPI-RequestTimestamp": date,
"vmmd-senderuri": "MVMAANDROID",
"x-downstream-switch": "use-legacy",
},
};
http.get(homeUrl, params);
http.get(serviceStatusUrl, params);
http.get(customerUrl, params);
http.get(ordersUrl, params);
sleep(2);
};
Local test run:
running (1m53.0s), 100/100 VUs, 2601 complete and 0 interrupted iterations
default [ 94% ] 100 VUs 1m53.0s/2m0s
running (1m54.0s), 100/100 VUs, 2642 complete and 0 interrupted iterations
default [ 95% ] 100 VUs 1m54.0s/2m0s
running (1m55.0s), 100/100 VUs, 2667 complete and 0 interrupted iterations
default [ 96% ] 100 VUs 1m55.0s/2m0s
running (1m56.0s), 100/100 VUs, 2702 complete and 0 interrupted iterations
default [ 97% ] 100 VUs 1m56.0s/2m0s
running (1m57.0s), 100/100 VUs, 2711 complete and 0 interrupted iterations
default [ 97% ] 100 VUs 1m57.0s/2m0s
running (1m58.0s), 100/100 VUs, 2724 complete and 0 interrupted iterations
default [ 98% ] 100 VUs 1m58.0s/2m0s
running (1m59.0s), 100/100 VUs, 2736 complete and 0 interrupted iterations
default [ 99% ] 100 VUs 1m59.0s/2m0s
running (2m00.0s), 100/100 VUs, 2772 complete and 0 interrupted iterations
default [ 100% ] 100 VUs 2m00.0s/2m0s
running (2m01.0s), 089/100 VUs, 2784 complete and 0 interrupted iterations
default ↓ [ 100% ] 100 VUs 2m0s
running (2m02.0s), 046/100 VUs, 2827 complete and 0 interrupted iterations
default ↓ [ 100% ] 100 VUs 2m0s
running (2m03.0s), 008/100 VUs, 2865 complete and 0 interrupted iterations
default ↓ [ 100% ] 100 VUs 2m0s
data_received..................: 19 MB 152 kB/s
data_sent......................: 1.3 MB 10 kB/s
http_req_blocked...............: avg=11.97ms min=0s med=0s max=3.14s p(90)=1µs p(95)=1µs
http_req_connecting............: avg=1.86ms min=0s med=0s max=371.48ms p(90)=0s p(95)=0s
http_req_duration..............: avg=1.96s min=31.61ms med=1.32s max=17.81s p(90)=4.03s p(95)=5.5s
{ expected_response:true }...: avg=1.96s min=31.61ms med=1.32s max=17.81s p(90)=4.03s p(95)=5.5s
http_req_failed................: 0.00% ✓ 0 ✗ 11492
http_req_receiving.............: avg=2.71ms min=5µs med=29µs max=253.89ms p(90)=9.84ms p(95)=13.98ms
http_req_sending...............: avg=32.6µs min=7µs med=28µs max=209µs p(90)=56µs p(95)=67µs
http_req_tls_handshaking.......: avg=9.11ms min=0s med=0s max=2.67s p(90)=0s p(95)=0s
http_req_waiting...............: avg=1.96s min=30.84ms med=1.31s max=17.81s p(90)=4.03s p(95)=5.49s
http_reqs......................: 11492 92.887212/s
iteration_duration.............: avg=4.24s min=1.04s med=3.88s max=19.56s p(90)=6.25s p(95)=7.49s
iterations.....................: 2873 23.221803/s
vus............................: 8 min=8 max=100
vus_max........................: 100 min=100 max=100
running (2m03.7s), 000/100 VUs, 2873 complete and 0 interrupted iterations
default ✓ [ 100% ] 100 VUs 2m0s
Test run on Blazemeter:
Partial log:
running (0m13.9s), 100/100 VUs, 14 complete and 0 interrupted iterations
default [ 12% ] 100 VUs 0m13.9s/2m0s
running (0m14.9s), 100/100 VUs, 48 complete and 0 interrupted iterations
default [ 12% ] 100 VUs 0m14.9s/2m0s
running (0m15.9s), 100/100 VUs, 97 complete and 0 interrupted iterations
default [ 13% ] 100 VUs 0m15.9s/2m0s
running (0m16.9s), 100/100 VUs, 105 complete and 0 interrupted iterations
default [ 14% ] 100 VUs 0m16.9s/2m0s
running (0m17.9s), 100/100 VUs, 105 complete and 0 interrupted iterations
default [ 15% ] 100 VUs 0m17.9s/2m0s
data_received..................: 2.6 MB 143 kB/s
data_sent......................: 270 kB 15 kB/s
http_req_blocked...............: avg=99.43ms min=127ns med=307ns max=1.31s p(90)=426.96ms p(95)=713.62ms
http_req_connecting............: avg=14.04ms min=0s med=0s max=795.66ms p(90)=48.57ms p(95)=96.8ms
http_req_duration..............: avg=9.75s min=394.17ms med=10.91s max=14.76s p(90)=13.55s p(95)=14.06s
{ expected_response:true }...: avg=9.75s min=394.17ms med=10.91s max=14.76s p(90)=13.55s p(95)=14.06s
http_req_failed................: 0.00% ✓ 0 ✗ 491
http_req_receiving.............: avg=81.18µs min=17.05µs med=33.77µs max=1.27ms p(90)=226.55µs p(95)=268.27µs
http_req_sending...............: avg=119.85µs min=17.04µs med=37.14µs max=16.9ms p(90)=83.49µs p(95)=105.71µs
http_req_tls_handshaking.......: avg=73.63ms min=0s med=0s max=1.12s p(90)=274ms p(95)=559.44ms
http_req_waiting...............: avg=9.75s min=394.04ms med=10.91s max=14.76s p(90)=13.55s p(95)=14.06s
http_reqs......................: 491 26.797839/s
iteration_duration.............: avg=13.57s min=1.88s med=14.78s max=16.63s p(90)=15.74s p(95)=15.9s
iterations.....................: 114 6.221902/s
vus............................: 100 min=100 max=100
vus_max........................: 100 min=100 max=100
running (0m18.3s), 000/100 VUs, 114 complete and 900 interrupted iterations
default ✗ [ 15% ] 100 VUs 0m18.3s/2m0s