parse-jtl
Version:
parse jmeter jtl files
1,023 lines (1,015 loc) • 19.4 kB
JavaScript
const { parse, aggregate } = require('../src');
const { expect } = require('chai');
describe('parse', () => {
it('simple jtl file', () => {
const result = parse('./tests/data/simple.jtl');
expect(result).deep.equals({
"requests": {
"call1": {
"label": "call1",
"samples": 4,
"errors": 1,
"elapsed_times": [
1170,
1131,
1023,
24
],
"max": 1170,
"min": 24,
"total": 3348,
"received": 175,
"sent": 175,
"start": 1448450968840,
"transaction": false,
"latencies": [],
"max_latency": 0,
"min_latency": 0,
"total_latency": 0,
"end": 1448450969996,
"tps": 3.46,
"average": 837,
"p50": 1131,
"p90": 1170,
"p95": 1170,
"p99": 1170,
"error_rate": 0.25,
"sent_rate": 0.15,
"received_rate": 0.15,
"median": 1077
},
"call2": {
"label": "call2",
"samples": 4,
"errors": 0,
"elapsed_times": [
2200,
1907,
938,
833
],
"max": 2200,
"min": 833,
"total": 5878,
"received": 180,
"sent": 180,
"start": 1448450969091,
"transaction": false,
"latencies": [],
"max_latency": 0,
"min_latency": 0,
"total_latency": 0,
"end": 1448450971403,
"tps": 1.73,
"average": 1469.5,
"p50": 1907,
"p90": 2200,
"p95": 2200,
"p99": 2200,
"error_rate": 0,
"sent_rate": 0.08,
"received_rate": 0.08,
"median": 1422.5
}
},
"transactions": {},
"total_requests": {
"label": "TOTAL",
"samples": 8,
"errors": 1,
"elapsed_times": [
2200,
1907,
1170,
1131,
1023,
938,
833,
24
],
"max": 2200,
"min": 24,
"total": 9226,
"received": 355,
"sent": 355,
"latencies": [],
"max_latency": 0,
"min_latency": 0,
"total_latency": 0,
"end": 1448450969996,
"start": 1448450968840,
"tps": 6.92,
"average": 1153.25,
"p50": 1131,
"p90": 2200,
"p95": 2200,
"p99": 2200,
"error_rate": 0.13,
"sent_rate": 0.31,
"received_rate": 0.31,
"median": 1077
},
"total_transactions": {
"label": "TOTAL",
"samples": 0,
"errors": 0,
"elapsed_times": [],
"max": 0,
"min": 0,
"total": 0,
"received": 0,
"sent": 0,
"latencies": [],
"max_latency": 0,
"min_latency": 0,
"total_latency": 0
},
"all": {
"call1": {
"label": "call1",
"samples": 4,
"errors": 1,
"elapsed_times": [
1170,
1131,
1023,
24
],
"max": 1170,
"min": 24,
"total": 3348,
"received": 175,
"sent": 175,
"start": 1448450968840,
"transaction": false,
"latencies": [],
"max_latency": 0,
"min_latency": 0,
"total_latency": 0,
"end": 1448450969996,
"tps": 3.46,
"average": 837,
"p50": 1131,
"p90": 1170,
"p95": 1170,
"p99": 1170,
"error_rate": 0.25,
"sent_rate": 0.15,
"received_rate": 0.15,
"median": 1077
},
"call2": {
"label": "call2",
"samples": 4,
"errors": 0,
"elapsed_times": [
2200,
1907,
938,
833
],
"max": 2200,
"min": 833,
"total": 5878,
"received": 180,
"sent": 180,
"start": 1448450969091,
"transaction": false,
"latencies": [],
"max_latency": 0,
"min_latency": 0,
"total_latency": 0,
"end": 1448450971403,
"tps": 1.73,
"average": 1469.5,
"p50": 1907,
"p90": 2200,
"p95": 2200,
"p99": 2200,
"error_rate": 0,
"sent_rate": 0.08,
"received_rate": 0.08,
"median": 1422.5
}
}
});
});
it('complex jtl file', () => {
const result = parse('./tests/data/complex.jtl');
expect(result.transactions).deep.equals({
"S01_Create_Booking_T01_Application_Launch": {
"label": "S01_Create_Booking_T01_Application_Launch",
"samples": 5,
"errors": 0,
"elapsed_times": [
1010,
521,
465,
358,
356
],
"max": 1010,
"min": 356,
"total": 2710,
"received": 230278,
"sent": 31395,
"start": 1675348044597,
"transaction": true,
"latencies": [],
"max_latency": 0,
"min_latency": 0,
"total_latency": 0,
"end": 1675348046211,
"tps": 3.1,
"average": 542,
"p50": 465,
"p90": 1010,
"p95": 1010,
"p99": 1010,
"error_rate": 0,
"sent_rate": 19.45,
"received_rate": 142.68,
"median": 465
},
"S01_Create_Booking_T02_Login": {
"label": "S01_Create_Booking_T02_Login",
"samples": 5,
"errors": 0,
"elapsed_times": [
4528,
4229,
3935,
3761,
2971
],
"max": 4528,
"min": 2971,
"total": 19424,
"received": 3165379,
"sent": 56080,
"start": 1675348045361,
"transaction": true,
"latencies": [],
"max_latency": 0,
"min_latency": 0,
"total_latency": 0,
"end": 1675348050152,
"tps": 1.04,
"average": 3884.8,
"p50": 3935,
"p90": 4528,
"p95": 4528,
"p99": 4528,
"error_rate": 0,
"sent_rate": 11.71,
"received_rate": 660.69,
"median": 3935
},
"S01_Create_Booking_T03_Select_Vertical": {
"label": "S01_Create_Booking_T03_Select_Vertical",
"samples": 5,
"errors": 0,
"elapsed_times": [
6,
5,
5,
4,
4
],
"max": 6,
"min": 4,
"total": 24,
"received": 25235,
"sent": 2660,
"start": 1675348048335,
"transaction": true,
"latencies": [],
"max_latency": 0,
"min_latency": 0,
"total_latency": 0,
"end": 1675348050157,
"tps": 2.74,
"average": 4.8,
"p50": 5,
"p90": 6,
"p95": 6,
"p99": 6,
"error_rate": 0,
"sent_rate": 1.46,
"received_rate": 13.85,
"median": 5
},
"S01_Create_Booking_T04_Fill_Details": {
"label": "S01_Create_Booking_T04_Fill_Details",
"samples": 5,
"errors": 0,
"elapsed_times": [
1926,
1867,
1613,
1035,
920
],
"max": 1926,
"min": 920,
"total": 7361,
"received": 22230,
"sent": 35450,
"start": 1675348048340,
"transaction": true,
"latencies": [],
"max_latency": 0,
"min_latency": 0,
"total_latency": 0,
"end": 1675348051770,
"tps": 1.46,
"average": 1472.2,
"p50": 1613,
"p90": 1926,
"p95": 1926,
"p99": 1926,
"error_rate": 0,
"sent_rate": 10.34,
"received_rate": 6.48,
"median": 1613
},
"S01_Create_Booking_T05_Search_Offers": {
"label": "S01_Create_Booking_T05_Search_Offers",
"samples": 5,
"errors": 0,
"elapsed_times": [
5336,
4508,
3811,
3393,
1714
],
"max": 5336,
"min": 1714,
"total": 18762,
"received": 29556,
"sent": 31785,
"start": 1675348050674,
"transaction": true,
"latencies": [],
"max_latency": 0,
"min_latency": 0,
"total_latency": 0,
"end": 1675348055795,
"tps": 0.98,
"average": 3752.4,
"p50": 3811,
"p90": 5336,
"p95": 5336,
"p99": 5336,
"error_rate": 0,
"sent_rate": 6.21,
"received_rate": 5.77,
"median": 3811
},
"S01_Create_Booking_T06_Click_Book-Now": {
"label": "S01_Create_Booking_T06_Click_Book-Now",
"samples": 5,
"errors": 5,
"elapsed_times": [
178,
85,
69,
56,
53
],
"max": 178,
"min": 53,
"total": 441,
"received": 7595,
"sent": 13685,
"start": 1675348052388,
"transaction": true,
"latencies": [],
"max_latency": 0,
"min_latency": 0,
"total_latency": 0,
"end": 1675348055854,
"tps": 1.44,
"average": 88.2,
"p50": 69,
"p90": 178,
"p95": 178,
"p99": 178,
"error_rate": 1,
"sent_rate": 3.95,
"received_rate": 2.19,
"median": 69
}
});
expect(result.total_transactions).deep.equals({
"label": "TOTAL",
"samples": 30,
"errors": 5,
"elapsed_times": [
5336,
4528,
4508,
4229,
3935,
3811,
3761,
3393,
2971,
1926,
1867,
1714,
1613,
1035,
1010,
920,
521,
465,
358,
356,
178,
85,
69,
56,
53,
6,
5,
5,
4,
4
],
"max": 5336,
"min": 4,
"total": 48722,
"received": 3480273,
"sent": 171055,
"latencies": [
4436,
3750,
3458,
3168,
3149,
3096,
2965,
2414,
2289,
2081,
1641,
1086,
1011,
979,
963,
860,
820,
815,
812,
576,
526,
520,
488,
488,
419,
349,
309,
309,
288,
203,
153,
139,
137,
129,
126,
123,
120,
114,
105,
105,
96,
90,
88,
80,
77,
75,
73,
61,
50,
48,
47,
46,
45,
44,
38,
37,
34,
33,
31,
30,
21,
19,
9,
8,
7,
7,
7,
7,
6,
6,
6,
6,
5,
5,
5,
4,
4,
4,
4,
4,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
],
"max_latency": 4436,
"min_latency": 0,
"total_latency": 46786,
"end": 1675348055854,
"start": 1675348044597,
"tps": 2.67,
"average": 1624.07,
"p50": 1010,
"p90": 4508,
"p95": 4528,
"p99": 5336,
"error_rate": 0.17,
"sent_rate": 15.2,
"received_rate": 309.17,
"median": 965,
"p50_latency": 7,
"p90_latency": 1011,
"p95_latency": 2965,
"p99_latency": 3750,
"average_latency": 359.89,
"median_latency": 7
});
expect(result.total_requests).deep.equals({
"label": "TOTAL",
"samples": 130,
"errors": 5,
"elapsed_times": [
4436,
3750,
3458,
3168,
3149,
3096,
2965,
2414,
2289,
2081,
1641,
1086,
1011,
979,
963,
860,
821,
815,
814,
576,
526,
520,
488,
488,
419,
349,
310,
309,
288,
245,
221,
207,
204,
203,
191,
182,
173,
156,
139,
138,
131,
130,
127,
123,
122,
106,
103,
90,
82,
77,
75,
74,
73,
61,
50,
49,
47,
47,
45,
44,
44,
38,
38,
37,
34,
33,
33,
31,
30,
27,
26,
21,
19,
19,
18,
18,
17,
16,
16,
14,
13,
13,
12,
12,
11,
10,
10,
10,
10,
10,
10,
10,
9,
9,
9,
9,
9,
9,
9,
9,
9,
9,
9,
9,
8,
8,
8,
8,
8,
8,
8,
8,
8,
8,
7,
7,
7,
7,
7,
7,
6,
6,
5,
5,
5,
5,
4,
4,
4,
4
],
"max": 4436,
"min": 4,
"total": 48722,
"received": 3480273,
"sent": 171055,
"latencies": [
4436,
3750,
3458,
3168,
3149,
3096,
2965,
2414,
2289,
2081,
1641,
1086,
1011,
979,
963,
860,
820,
815,
812,
576,
526,
520,
488,
488,
419,
349,
309,
309,
288,
203,
153,
139,
137,
129,
126,
123,
120,
114,
105,
105,
96,
90,
88,
80,
77,
75,
73,
61,
50,
48,
47,
46,
45,
44,
38,
37,
34,
33,
31,
30,
21,
19,
9,
8,
7,
7,
7,
7,
6,
6,
6,
6,
5,
5,
5,
4,
4,
4,
4,
4,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
],
"max_latency": 4436,
"min_latency": 0,
"total_latency": 46786,
"end": 1675348055854,
"start": 1675348044599,
"tps": 11.55,
"average": 374.78,
"p50": 34,
"p90": 1011,
"p95": 2965,
"p99": 3750,
"error_rate": 0.04,
"sent_rate": 15.2,
"received_rate": 309.22,
"median": 33.5,
"average_latency": 359.89,
"p50_latency": 7,
"p90_latency": 1011,
"p95_latency": 2965,
"p99_latency": 3750,
"median_latency": 7
});
});
});
describe('aggregate', () => {
it('simple jtl file', () => {
const result = aggregate('./tests/data/complex.jtl');
expect(result).deep.equals([
{
"Label": "S01_Create_Booking_T01_Application_Launch",
"# Samples": 5,
"Throughput": 3.1,
"Average": 542,
"Median": 465,
"90% Line": 1010,
"95% Line": 1010,
"99% Line": 1010,
"Min": 356,
"Max": 1010,
"Error %": "0%",
"Sent KB/sec": 19.45,
"Received KB/sec": 142.68
},
{
"Label": "S01_Create_Booking_T02_Login",
"# Samples": 5,
"Throughput": 1.04,
"Average": 3884.8,
"Median": 3935,
"90% Line": 4528,
"95% Line": 4528,
"99% Line": 4528,
"Min": 2971,
"Max": 4528,
"Error %": "0%",
"Sent KB/sec": 11.71,
"Received KB/sec": 660.69
},
{
"Label": "S01_Create_Booking_T03_Select_Vertical",
"# Samples": 5,
"Throughput": 2.74,
"Average": 4.8,
"Median": 5,
"90% Line": 6,
"95% Line": 6,
"99% Line": 6,
"Min": 4,
"Max": 6,
"Error %": "0%",
"Sent KB/sec": 1.46,
"Received KB/sec": 13.85
},
{
"Label": "S01_Create_Booking_T04_Fill_Details",
"# Samples": 5,
"Throughput": 1.46,
"Average": 1472.2,
"Median": 1613,
"90% Line": 1926,
"95% Line": 1926,
"99% Line": 1926,
"Min": 920,
"Max": 1926,
"Error %": "0%",
"Sent KB/sec": 10.34,
"Received KB/sec": 6.48
},
{
"Label": "S01_Create_Booking_T05_Search_Offers",
"# Samples": 5,
"Throughput": 0.98,
"Average": 3752.4,
"Median": 3811,
"90% Line": 5336,
"95% Line": 5336,
"99% Line": 5336,
"Min": 1714,
"Max": 5336,
"Error %": "0%",
"Sent KB/sec": 6.21,
"Received KB/sec": 5.77
},
{
"Label": "S01_Create_Booking_T06_Click_Book-Now",
"# Samples": 5,
"Throughput": 1.44,
"Average": 88.2,
"Median": 69,
"90% Line": 178,
"95% Line": 178,
"99% Line": 178,
"Min": 53,
"Max": 178,
"Error %": "1%",
"Sent KB/sec": 3.95,
"Received KB/sec": 2.19
},
{
"Label": "TOTAL",
"# Samples": 30,
"Throughput": 2.67,
"Average": 1624.07,
"Median": 965,
"90% Line": 4508,
"95% Line": 4528,
"99% Line": 5336,
"Min": 4,
"Max": 5336,
"Error %": "0.17%",
"Sent KB/sec": 15.2,
"Received KB/sec": 309.17,
"Average Latency": 359.89,
"90% Latency": 1011,
"95% Latency": 2965,
"99% Latency": 3750,
"Median Latency": 7,
"Min Latency": 0,
"Max Latency": 4436
}
]);
});
});