From 214bcf31bb20c63e33792a011d7a8fefbb342fcd Mon Sep 17 00:00:00 2001 From: PxlLoewe <72106766+PxlLoewe@users.noreply.github.com> Date: Sun, 29 Jun 2025 04:07:58 -0700 Subject: [PATCH] added tracker test --- tests/aircrafts.js | 24 ------------------------ tests/tracker.js | 26 ++++++++++++++++++++++++++ 2 files changed, 26 insertions(+), 24 deletions(-) delete mode 100644 tests/aircrafts.js create mode 100644 tests/tracker.js diff --git a/tests/aircrafts.js b/tests/aircrafts.js deleted file mode 100644 index 4eb657b2..00000000 --- a/tests/aircrafts.js +++ /dev/null @@ -1,24 +0,0 @@ -import http from "k6/http"; -import { check, sleep } from "k6"; - -export const options = { - vus: 10, // virtuelle Nutzer gleichzeitig - duration: "30s", // Testdauer -}; - -export default function () { - const res = http.get("https://dispatch.premiumag.de/api/aircrafts"); - const res2 = http.get("https://dispatch.premiumag.de/api/dispatcher"); - - check(res, { - "Status Piloten ist 200": (r) => r.status === 200, - "Antwort enthält Daten": (r) => r.body && r.body.length > 1, - }); - - check(res2, { - "Status Dispatcher ist 200": (r) => r.status === 200, - "Antwort enthält Daten": (r) => r.body && r.body.length > 1, - }); - - sleep(1); // optional, Wartezeit zwischen Requests -} diff --git a/tests/tracker.js b/tests/tracker.js new file mode 100644 index 00000000..b739bfdf --- /dev/null +++ b/tests/tracker.js @@ -0,0 +1,26 @@ +import http from "k6/http"; +import { check, sleep } from "k6"; + +export let options = { + stages: [ + { duration: "1m", target: 50 }, // 50 Benutzer + { duration: "1m", target: 100 }, // 100 Benutzer + { duration: "1m", target: 200 }, // 200 Benutzer + { duration: "1m", target: 400 }, // 400 Benutzer + { duration: "1m", target: 800 }, // 800 Benutzer + { duration: "1m", target: 1600 }, // 1600 Benutzer + { duration: "1m", target: 0 }, // runterfahren + ], + thresholds: { + http_req_duration: ["p(95)<800"], // 95% der Anfragen < 800ms + http_req_failed: ["rate<0.05"], // Fehlerrate < 5% + }, +}; + +export default function () { + let res = http.get("https://dispatch.premiumag.de/tracker"); + check(res, { + "Status ist 200": (r) => r.status === 200, + }); + sleep(1); // simuliert Benutzerverhalten +}