diff --git a/scripts/numberofVUs/constantVUs/10VUs.js b/scripts/numberofVUs/constantVUs/10VUs.js new file mode 100644 index 0000000..0d58a40 --- /dev/null +++ b/scripts/numberofVUs/constantVUs/10VUs.js @@ -0,0 +1,29 @@ + +import http from 'k6/http'; +import { group, sleep } from 'k6'; + +const BASE_URL = `http://${__ENV.HOST || 'localhost'}:8080/tools.descartes.teastore.webui`; + +const groupResponseTimes = {}; + +export const options = { + discardResponseBodies: true, + scenarios: { + blackTeaBrowse: { + executor: 'constant-vus', + vus: 10, + duration: '30s', + }, + }, +}; + +export default function () { + group('Black Tea Category Browse', () => { + const start = new Date(); + http.get(`${BASE_URL}/category?category=2&page=1`); + const end = new Date(); + const duration = end - start; + groupResponseTimes['Black Tea Category Browse'] = (groupResponseTimes['Black Tea Category Browse'] || 0) + duration; + sleep(1); + }); +} \ No newline at end of file diff --git a/scripts/numberofVUs/constantVUs/50VUs.js b/scripts/numberofVUs/constantVUs/50VUs.js new file mode 100644 index 0000000..68e1267 --- /dev/null +++ b/scripts/numberofVUs/constantVUs/50VUs.js @@ -0,0 +1,29 @@ + +import http from 'k6/http'; +import { group, sleep } from 'k6'; + +const BASE_URL = `http://${__ENV.HOST || 'localhost'}:8080/tools.descartes.teastore.webui`; + +const groupResponseTimes = {}; + +export const options = { + discardResponseBodies: true, + scenarios: { + blackTeaBrowse: { + executor: 'constant-vus', + vus: 50, + duration: '30s', + }, + }, +}; + +export default function () { + group('Black Tea Category Browse', () => { + const start = new Date(); + http.get(`${BASE_URL}/category?category=2&page=1`); + const end = new Date(); + const duration = end - start; + groupResponseTimes['Black Tea Category Browse'] = (groupResponseTimes['Black Tea Category Browse'] || 0) + duration; + sleep(1); + }); +} \ No newline at end of file diff --git a/scripts/numberofVUs/constantVUs.js b/scripts/numberofVUs/constantVUs/constantVUs.js similarity index 87% rename from scripts/numberofVUs/constantVUs.js rename to scripts/numberofVUs/constantVUs/constantVUs.js index 1b50059..b043e52 100644 --- a/scripts/numberofVUs/constantVUs.js +++ b/scripts/numberofVUs/constantVUs/constantVUs.js @@ -2,7 +2,7 @@ import http from 'k6/http'; import { group, sleep } from 'k6'; -const BASE_URL = `http://10.1.10.210:8080/tools.descartes.teastore.webui`; +const BASE_URL = `http://${__ENV.HOST || 'localhost'}:8080/tools.descartes.teastore.webui`; const groupResponseTimes = {}; diff --git a/scripts/numberofVUs/rampingVUs/ramping2.js b/scripts/numberofVUs/rampingVUs/ramping2.js new file mode 100644 index 0000000..cf3a6c0 --- /dev/null +++ b/scripts/numberofVUs/rampingVUs/ramping2.js @@ -0,0 +1,38 @@ + +import http from 'k6/http'; +import { group, sleep } from 'k6'; + +const BASE_URL = `http://${__ENV.HOST || 'localhost'}:8080/tools.descartes.teastore.webui`; + +const groupResponseTimes = {}; + +//Spikes +export const options = { + discardResponseBodies: true, + scenarios: { + blackTeaBrowse: { + executor: 'ramping-vus', + startVUs: 0, + stages: [ + { duration: '30s', target: 70 }, + { duration: '10s', target: 0 }, + { duration: '20s', target: 80 }, + { duration: '10s', target: 0 }, + { duration: '20s', target: 100 }, + { duration: '10s', target: 0 }, + ], + gracefulRampDown: '0s', + }, + }, +}; + +export default function () { + group('Black Tea Category Browse', () => { + const start = new Date(); + http.get(`${BASE_URL}/category?category=2&page=1`); + const end = new Date(); + const duration = end - start; + groupResponseTimes['Black Tea Category Browse'] = (groupResponseTimes['Black Tea Category Browse'] || 0) + duration; + sleep(1); + }); +} \ No newline at end of file diff --git a/scripts/numberofVUs/rampingVUs.js b/scripts/numberofVUs/rampingVUs/rampingVUs.js similarity index 89% rename from scripts/numberofVUs/rampingVUs.js rename to scripts/numberofVUs/rampingVUs/rampingVUs.js index 4317bbf..58c604f 100644 --- a/scripts/numberofVUs/rampingVUs.js +++ b/scripts/numberofVUs/rampingVUs/rampingVUs.js @@ -2,7 +2,7 @@ import http from 'k6/http'; import { group, sleep } from 'k6'; -const BASE_URL = `http://10.1.10.210:8080/tools.descartes.teastore.webui`; +const BASE_URL = `http://${__ENV.HOST || 'localhost'}:8080/tools.descartes.teastore.webui`; const groupResponseTimes = {};