added tracker test

This commit is contained in:
PxlLoewe
2025-06-29 04:07:58 -07:00
parent 8ad558113d
commit 214bcf31bb
2 changed files with 26 additions and 24 deletions

View File

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

26
tests/tracker.js Normal file
View File

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