Search code examples
controllertransactionsjmeterresponsebeanshell

Jmeter: Beanshell code to get response time of all the Sampler(sum of) under one Transaction controller


I need to capture the response time Transaction controller i.e; the sum up response time of Sample A and Sample B.

Instead of prev.getTime(), do we have any function which will return the transaction response time of a Transactioncontroller ; sum of all the individual sampler under it.enter image description here

Currently if I give the prev.getTime() under transaction controller tree, it will display the individual response time of Sample A and Sample B.


Solution

  • //Get Sample name
     TransactionName = sampleResult.getSampleLabel();
    // Response Time
     responseTime = sampleResult.getTime();
    // Response  Size
     size = sampleResult.getBytesAsLong();
    //Status in true or false
     isSuccessful =sampleResult.isSuccessful();