* Add JSR223 PostProcessor
   
<https://jmeter.apache.org/usermanual/component_reference.html#JSR223_PostProcessor>
   as a child of the request which response time you want to modify

 * Put the following code into "Script" area:

org.apache.commons.lang3.reflect.FieldUtils.writeField(prev,'elapsedTime',5L,true)

 * Replace *42* with the desired response time value

 * ....

 * Profit?

In the above example *prev *stands for the *prev*ious SampleResult <https://jmeter.apache.org/api/org/apache/jmeter/samplers/SampleResult.html>, see Top 8 JMeter Java Classes You Should Be Using with Groovy <https://www.blazemeter.com/blog/jmeter-java-classes> article for more information on this and other JMeter API shorthands available for the JSR223 Test Elements


On 8/5/2022 3:35 PM, Tong Sun wrote:
Hi,

Is it possible to change the request response time (via jsr223)?

I need to fetch one important number, and instead of trying to create a way
to report it somehow, I'm thinking the easiest way to report and track it
is to set the fetched number as the request's response time.

thanks

Reply via email to