How to Get Values of JMeter HTML Dashboard Report in Seconds?
How to Get Values of JMeter HTML Dashboard Report in Seconds?
In general or normally, the values in tabular columns of JMeter HTML Report comes in milliseconds as shown below as example:-
Many a times it become troublesome or extra work to convert these values from milliseconds to Seconds and then show them to Client or Stockholder in final reporting. Client and Stakeholders also does not prefer values in milliseconds, they asks for values in Seconds.
In this article, I will address how to solve this challenge.
Follow the below steps:-
Step-1:- Goto “bin” folder inside JMeter directory. The goto“report-template\content\js” location and open file “dashboard.js.fmkr” using Notepadd++. Illustration shown below:-
Step-2:- Find the line cell.innerHTML = “Response Times (ms)”; as illustrated below-
And change ms to Sec, e.g.:-cell.innerHTML = “Response Times (Sec)”;as illustrated below-
Step-3:-Next, Find the line // Create statistics table. There will be some values under “switch” loop, as illustrated below-
Here, you need to replace the lines from switch(index) toreturn item; by below lines exactly same:-
switch(index){
// Errors pct, 3rd Column
case 3:
item = item.toFixed(2) + ‘%’;
break;
// Average, 4th Column
case 4:
item = (item/1000).toFixed(2);
break;
// Min, 5th Column
case 5:
item = (item/1000).toFixed(2);
break;
// Max, 6th Column
case 6:
item = (item/1000).toFixed(2);
break;
// 90th pct, 7th Column
case 7:
item = (item/1000).toFixed(2);
break;
// 95th pct, 8th Column
case 8:
item = (item/1000).toFixed(2);
break;
// 99th pct, 9th Column
case 9:
item = (item/1000).toFixed(2);
break;
case 10:
// Throughput
case 11:
// Kbytes/s
case 12:
// Sent Kbytes/s
item = item.toFixed(2);
break;
}
return item;
For JMeter v5.3& above, replace the lines from switch(index) toreturn item; by below lines exactly same:-
switch(index){
// Errors pct, 3rd Column
case 3:
item = item.toFixed(2) + ‘%’;
break;
// Average, 4th Column
case 4:
item = (item/1000).toFixed(2);
break;
// Min, 5th Column
case 5:
item = (item/1000).toFixed(2);
break;
// Max, 6th Column
case 6:
item = (item/1000).toFixed(2);
break;
// Median, 7th Column
case 7:
item = (item/1000).toFixed(2);
break;
// 90th pct, 8th Column
case 8:
item = (item/1000).toFixed(2);
break;
// 95th pct, 9th Column
case 9:
item = (item/1000).toFixed(2);
break;
// 99th pct, 10th Column
case 10:
item = (item/1000).toFixed(2);
break;
case 11:
// Throughput
case 12:
// Kbytes/s
case 13:
// Sent Kbytes/s
item = item.toFixed(2);
break;
}
return item;
This is illustrated below-
Here, each case number represents a column of Statistics Table in HTML Report.
Case 3 is for 3rd Column, i.e. Error%.
Case 4 is for 4th Column, i.e. Average.
Case 5 is for 5th Column, i.e. Min.
Case 6 is for 6th Column, i.e. Max.
Case 7 is for 7th Column, i.e. 90th pct.
Case 8 is for 8th Column, i.e. 95th pct.
Case 9 is for 9th Column, i.e. 99th pct.
Case 10, Case 11 and Case 12 are for last 3 Columns respectively.
That’s all, after these changes, save this file, restart your JMeter, and start generating the Report. The values will be coming in Seconds, as illustrated below-
Isha training solutions is offering ” Jmeter Core to Master” level course. For complete details, pls follow below link