Hi,
I am trying to calculate 90% response time against threshold value in Jmeter. Idea is to run that test in CI mode.
Basic requirement: thread count is one but needs to run for 50 times. so I have added loop count
Also, in following groovy script I would like to store all the load time in the list. can I use post-processor for this or listener?
//list to store time
List<Long> responseTimeList = new ArrayList()
// the list filling
responseTimeList.add(sampleResult.getTime())
// store variables
vars.putObject("responseTimeList", responseTimeList)
the only issue with the above script it does not add all the load time for all the request , it contains only one load time. Can you please able to check what needs to change here?
Following script, I would like to run once after all the loop finished to check 90% response time. Can you please suggest what listener shall I use which will run only once?
//get the list in another list
List<Long> timeList = vars.getObject("responseTimeList")
timeList.sort{it}
Long FinalResponsetime = 0
Long ThresholdTime= 3000;
//Long threads = ctx.getThreadGroup().getNumberOfThreads() // this line gets current threads, this is the reason using list.size(), but some how list store only single value
int threads = timeList.size()
log.info("(threads: " + threads);
int index = (threads*9)/10
FinalResponsetime = timeList.get(index)
log.info("(90% Response time: " + FinalResponsetime);
if(FinalResponsetime>=ThresholdTime) {
sampleResult.setSuccessful(false);
sampleResult.setResponseMessage("Error: 90% Average response time"+ "FinalResponsetime"+ " is greater than threshold "+ThresholdTime );
log.info("ThresholdTime: " + ThresholdTime);
}
can you please able to help me with.
Thank you,
Nishant
Instructor
Abhishek Puri Replied on 18/05/2020
Please share your project so that I can suggest you a solution.