-
Notifications
You must be signed in to change notification settings - Fork 40
/
Copy pathk6.js
72 lines (66 loc) · 1.44 KB
/
k6.js
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
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
// vim:ts=2:sts=2:sw=2:et
// run: k6 run k6.js
//
// Author: Hari Sekhon
// Date: [% DATE # 2022-07-08 15:21:05 +0100 (Fri, 08 Jul 2022) %]
//
// [% URL %]
//
// [% LICENSE %]
//
// [% MESSAGE %]
//
// [% LINKEDIN %]
//
// https://k6.io/docs/getting-started/running-k6/
import http from 'k6/http';
import { sleep } from 'k6';
// instead of setting on k6 CLI --vus 10 --duration 30s
export const options = {
vus: 10,
duration: '30s',
// or run more complex scenarios of traffic patterns
//
// https://k6.io/docs/using-k6/scenarios/
//
//scenarios: {
// example_scenario: {
// // name of the executor to use
// executor: 'shared-iterations',
//
// // common scenario configuration
// startTime: '10s',
// gracefulStop: '5s',
// env: { EXAMPLEVAR: 'testing' },
// tags: { example_tag: 'testing' },
//
// // executor-specific configuration
// vus: 10,
// iterations: 200,
// maxDuration: '10s',
// }
//}
};
export default function () {
http.get('https://test.k6.io');
sleep(1);
}
// more complex requests such as logins
//
// https://k6.io/docs/using-k6/http-requests/
//
//export default function () {
// const url = 'http://test.k6.io/login';
// const payload = JSON.stringify({
// email: 'aaa',
// password: 'bbb',
// });
//
// const params = {
// headers: {
// 'Content-Type': 'application/json',
// },
// };
//
// http.post(url, payload, params);
//}