@@ -2,6 +2,8 @@ import { group, sleep } from 'k6';
2
2
3
3
import http from 'k6/http' ;
4
4
5
+ const groupResponseTimes = { } ;
6
+
5
7
export const options = {
6
8
stages : [
7
9
{ duration : '10s' , target : 5 } ,
@@ -19,32 +21,56 @@ export default function () {
19
21
const BASE_URL = `http://${ ABHAY_IP } :8080/tools.descartes.teastore.webui` ;
20
22
21
23
group ( 'TeaStore Homepage Browse' , ( ) => {
24
+ const start = new Date ( ) ;
22
25
http . get ( `${ BASE_URL } /` ) ;
26
+ const end = new Date ( ) ;
27
+ const duration = end - start ;
28
+ groupResponseTimes [ 'TeaStore Homepage Browse' ] = ( groupResponseTimes [ 'TeaStore Homepage Browse' ] || 0 ) + duration ;
23
29
sleep ( 1 ) ;
24
30
} ) ;
25
31
26
32
group ( 'TeaStore Login User' , ( ) => {
33
+ const start = new Date ( ) ;
27
34
http . get ( `${ BASE_URL } /login` ) ;
28
- sleep ( 1 ) ;
35
+ const end = new Date ( ) ;
36
+ const duration = end - start ;
37
+ groupResponseTimes [ 'TeaStore Login User' ] = ( groupResponseTimes [ 'TeaStore Login User' ] || 0 ) + duration ;
38
+ sleep ( 1 ) ;
29
39
} ) ;
30
40
31
41
group ( 'Black Tea Category Browse' , ( ) => {
42
+ const start = new Date ( ) ;
32
43
http . get ( `${ BASE_URL } /category?category=2&page=1` ) ;
44
+ const end = new Date ( ) ;
45
+ const duration = end - start ;
46
+ groupResponseTimes [ 'Black Tea Category Browse' ] = ( groupResponseTimes [ 'Black Tea Category Browse' ] || 0 ) + duration ;
33
47
sleep ( 1 ) ;
34
48
} ) ;
35
49
36
50
group ( 'Earl Grey (loose) Tea Product View' , ( ) => {
51
+ const start = new Date ( ) ;
37
52
http . get ( `${ BASE_URL } /product?id=7` ) ;
53
+ const end = new Date ( ) ;
54
+ const duration = end - start ;
55
+ groupResponseTimes [ 'Earl Grey (loose) Tea Product View' ] = ( groupResponseTimes [ 'Earl Grey (loose) Tea Product View' ] || 0 ) + duration ;
38
56
sleep ( 1 ) ;
39
57
} ) ;
40
58
41
- group ( 'TeaStore ViewCart' , ( ) => {
59
+ group ( 'TeaStore View Cart' , ( ) => {
60
+ const start = new Date ( ) ;
42
61
http . get ( `${ BASE_URL } /cart` ) ;
62
+ const end = new Date ( ) ;
63
+ const duration = end - start ;
64
+ groupResponseTimes [ 'TeaStore View Cart' ] = ( groupResponseTimes [ 'TeaStore View Cart' ] || 0 ) + duration ;
43
65
sleep ( 1 ) ;
44
66
} ) ;
45
67
46
68
group ( 'TeaStore Checkout' , ( ) => {
69
+ const start = new Date ( ) ;
47
70
http . get ( `${ BASE_URL } /order` ) ;
71
+ const end = new Date ( ) ;
72
+ const duration = end - start ;
73
+ groupResponseTimes [ 'TeaStore Checkout' ] = ( groupResponseTimes [ 'TeaStore Checkout' ] || 0 ) + duration ;
48
74
sleep ( 1 ) ;
49
75
} ) ;
50
76
}
0 commit comments