I want to add my summary report results in the email body. So I have added the bean shell post-processor against my request and add the below functions in it.
*<BeanShellPostProcessor guiclass="TestBeanGUI" testclass="BeanShellPostProcessor" testname="BeanShell PostProcessor" enabled="true">
<boolProp name="resetInterpreter">false</boolProp>
<stringProp name="parameters"></stringProp>
<stringProp name="filename"></stringProp>
<stringProp name="script">float duration = prev.getTime()/1000;
props.put("getDTS_response", String.valueOf(duration));</stringProp>
</BeanShellPostProcessor>*
Funtion used in mail body:
*"Request 1 Reponse ${__property(getDTS_response,0)} Seconds"*
Now when I receive the results in the mail body, those are displayed as below.
Summary Report Result against request # 1: 8563
Result against request 1 in mail body: 8.0 seconds
Summary Report Result against request # 2: 354
Result against request 1 in mail body: 0.0 seconds
I want my results as below:
Result against request 1 in mail body: 8.563 seconds
Result against request 2 in mail body: 0.354 seconds
Please guide in resolving the issue.
Thanks and Regards
Since JMeter 3.1 you should be using JSR223 Test Elements and Groovy language for scripting so I'll provide a Groovy solution:
Demo:
More information: