Skip to content

Commit abc9894

Browse files
committed
Add har-to-k6 load test conversion script
1 parent afef4e7 commit abc9894

File tree

2 files changed

+19
-10
lines changed

2 files changed

+19
-10
lines changed

dump/npm-global

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,3 +19,4 @@ playwright
1919
azurite
2020
aicommits
2121
genkit
22+
har-to-k6

loadtest/simple.js

Lines changed: 18 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,24 @@
1-
import http from 'k6/http'
2-
import { sleep } from 'k6'
1+
import http from "k6/http";
2+
import { check, sleep } from "k6";
33

4-
// See https://grafana.com/docs/k6/latest/using-k6/k6-options/
4+
// Test configuration
55
export const options = {
6-
vus: 10,
7-
duration: '30s',
8-
cloud: {
9-
name: 'YOUR TEST NAME',
6+
thresholds: {
7+
// Assert that 99% of requests finish within 3000ms.
8+
http_req_duration: ["p(99) < 3000"],
109
},
11-
}
10+
// Ramp the number of virtual users up and down
11+
stages: [
12+
{ duration: "30s", target: 15 },
13+
{ duration: "1m", target: 15 },
14+
{ duration: "20s", target: 0 },
15+
],
16+
};
1217

18+
// Simulated user behavior
1319
export default function () {
14-
http.get('https://test.k6.io')
15-
sleep(1)
20+
let res = http.get("https://test-api.k6.io/public/crocodiles/1/");
21+
// Validate response status
22+
check(res, { "status was 200": (r) => r.status == 200 });
23+
sleep(1);
1624
}

0 commit comments

Comments
 (0)