forked from antonputra/tutorials
-
Notifications
You must be signed in to change notification settings - Fork 0
/
test.js
53 lines (44 loc) · 1.29 KB
/
test.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
import http from 'k6/http';
import { sleep, group, check } from 'k6';
export const options = {
stages: [
{ target: 30, duration: '10m' },
{ target: 5, duration: '10m' },
{ target: 10, duration: '10m' },
{ target: 50, duration: '10m' },
]
};
const url = 'http://54.221.99.119/api/devices'
export default () => {
group('Send GET requests', () => {
const res = http.get(url);
const checkRes = check(res, {
'status is 200': (r) => r.status === 200,
});
});
group('Send GET requests 2', () => {
const res = http.get(url);
const checkRes = check(res, {
'status is 200': (r) => r.status === 200,
});
});
group('Send GET requests 3', () => {
const res = http.get(url);
const checkRes = check(res, {
'status is 200': (r) => r.status === 200,
});
});
group('Send POST requests', () => {
const res = http.post(url);
const checkRes = check(res, {
'status is 201': (r) => r.status === 201,
});
});
group('Send wrong page requests', () => {
const res = http.put(url);
const checkRes = check(res, {
'status is 405': (r) => r.status === 405,
});
});
sleep(1);
};