1
votes

I'm trying the get the response time for the complete test case (All transactions) in JMeter. I'll be using it for calculating pacing using JSR223 Timer

I am able to get time for single sample using prev.getTime() but when I use prev.getParent().getTime(), I don't see anything in logs and script doesn't halt for pacing.

I have also tried placing the timer at a different level (Scope of thread group) still nothing. Where I am going wrong here?

Thanks, Sachin

1

1 Answers

0
votes

prev.getParent() function is applicable for subresults for example when the Sampler is a child of a Transaction Controller.

If you have a single Sampler somewhere in Thread Group it will not have any parent hence your function will fail with the NPE.

You can work it around by introducing checking this getParent() for null like:

def time = 0
if (prev.getParent() != null) {
    time = prev.getParent().getTime()
} 
else {
    time = prev.getTime()
}

Check out How to Easily Implement Pacing in JMeter article for more comprehensive information if needed.