Here is example code you could use in the  JSR223 Listener
<https://jmeter.apache.org/usermanual/component_reference.html#JSR223_Listener> 
, it produces more or less the same output as the Debug PostProcessor:


> def subResult = new org.apache.jmeter.samplers.SampleResult()
> subResult.setSuccessful(true)
> def responseBody = new StringBuilder()
> def newline = System.getProperty('line.separator')
> 
> responseBody.append('SamplerProperties:').append(newline)
> 
> sampler.getProperties().each { property ->
>    
> responseBody.append(property.getKey()).append('=').append(property.getValue()).append(newline)
> }
> 
> responseBody.append('JMeterVariables:').append(newline)
> vars.entrySet().each { var ->
>    
> responseBody.append(var.getKey()).append('=').append(var.getValue()).append(newline)
> }
> 
> subResult.setResponseData(responseBody as String, 'UTF-8')
> 
> prev.addSubResult(subResult)

In the above code:

*prev* - stands for parent  SampleReuslt
<https://jmeter.apache.org/api/org/apache/jmeter/samplers/SampleResult.html>  
*vars* - stands for  JMeterVariables
<https://jmeter.apache.org/api/org/apache/jmeter/threads/JMeterVariables.html> 
class instance 

See  Top 8 JMeter Java Classes You Should Be Using with Groovy
<https://www.blazemeter.com/blog/top-8-jmeter-java-classes-you-should-be-using-with-groovy>
  
article to learn more about the above and other JMeter API shorthands
available for the JSR223 test elements .



--
Sent from: http://www.jmeter-archive.org/JMeter-User-f512775.html

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to