-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathk6scriptread.js
38 lines (34 loc) · 1.18 KB
/
k6scriptread.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
/* eslint-disable import/no-unresolved */
import http from 'k6/http';
import { check, sleep } from 'k6';
// import faker from 'faker';
export const options = {
vus: 100,
duration: '60s',
};
export default function () {
const res = http.get(`http://localhost:3003/properties/${Math.floor(Math.random() * 10000000)}/reviews`);
check(res, {
'status was 200': (r) => r.status === 200,
'transaction time OK': (r) => r.timings.duration < 200,
});
sleep(0.05);
}
// const formData = {
// userName: 'Uzumaki',
// reviewComment: 'Rasengannnnnn',
// communication: Math.round(Math.random() * 1.3 + 3.7),
// check: Math.round(Math.random() * 1.3 + 3.7),
// clean: Math.round(Math.random() * 1.3 + 3.7),
// accuracy: Math.round(Math.random() * 1.3 + 3.7),
// location: Math.round(Math.random() * 1.3 + 3.7),
// value: Math.round(Math.random() * 1.3 + 3.7),
// };
// export default function () {
// const res = http.post(`http://localhost:3003/properties/${Math.floor(Math.random() * 10000000)}/reviews`, formData);
// check(res, {
// 'status was 200': (r) => r.status === 200,
// 'transaction time OK': (r) => r.timings.duration < 200,
// });
// sleep(0.05);
// }