-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathscript.ts
More file actions
31 lines (28 loc) · 756 Bytes
/
Copy pathscript.ts
File metadata and controls
31 lines (28 loc) · 756 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
import http from "k6/http";
import { check, sleep } from "k6";
const url = "http://tinyauth.127.0.0.1.sslip.io/api/user/login";
const credentials = {
username: "user",
password: "password",
};
export const options = {
stages: [
{ duration: "5m", target: 50 },
{ duration: "5m", target: 100 },
{ duration: "5m", target: 150 },
{ duration: "5m", target: 200 },
{ duration: "5m", target: 250 },
{ duration: "5m", target: 300 },
],
};
export default function () {
const payload = JSON.stringify(credentials);
const res = http.post(url, payload);
check(res, {
"is status 200": (r) => r.status === 200,
});
check(res, {
"login successful": (r) => r.json("message") === "Login successful",
});
sleep(1);
}