It's working as expected.
Thank you very much Dmitri.

On Thu, Aug 3, 2023 at 5:58 PM Dmitri T <glin...@live.com> wrote:

> Deepak Chaudhari wrote:
> > Hi Dmitri.
> >
> > Instead of showing the whole response body, is it possible to show
> > some part of it using Regular Expression?
> >
> > On Wed, Aug 2, 2023 at 9:19 PM Deepak Chaudhari
> > <deepak.myp...@gmail.com <mailto:deepak.myp...@gmail.com>> wrote:
> >
> >     Dmitri,
> >     Please ignore the above message.
> >     HTML report creation is working now.
> >
> >
> >     On Wed, Aug 2, 2023 at 8:56 PM Abhitosh Patil
> >     <abhitosh...@gmail.com <mailto:abhitosh...@gmail.com>> wrote:
> >
> >         Thanks for the reply Dmitri.
> >         But after adding JSR223 post processor, getting below error
> >         while generating HTML report:
> >
> >         image.png
> >
> >         On Wed, Aug 2, 2023 at 8:34 PM Dmitri T <glin...@live.com
> >         <mailto:glin...@live.com>> wrote:
> >
> >             Deepak Chaudhari wrote:
> >             > Hi,
> >             >
> >             > We have a requirement in which we need to show responses
> >             of failed requests
> >             > in JMeter HTML dashboard reports.
> >             > Right now it's just showing something like "404/Bad
> >             request". Instead of
> >             > that we need to show the actual response or a part of
> >             the response.
> >             >
> >             > Thanks in advance
> >             > Deepak
> >             >
> >             As of JMeter 5.6.2
> >             <
> https://lists.apache.org/thread/49dnwvyozy535ogwqvdvbkwkgk0xkrrl>:
> >
> >              1. HTML Reporting Dashboard can only be generated from
> >             .jtl result
> >                 files in CSV format
> >
> >             <
> https://jmeter.apache.org/usermanual/generating-dashboard.html#overview>
> >              2. CSV format of result files does not support saving
> >             response data
> >
> >             <
> https://github.com/apache/jmeter/blob/rel/v5.6.2/bin/jmeter.properties#L512
> >
> >
> >
> >             So the only "non-invasive" way is appending the response
> >             message with
> >             the response data for failing samplers, you can do this
> >             using JSR223
> >             PostProcessor
> >             <
> https://jmeter.apache.org/usermanual/component_reference.html#JSR223_PostProcessor
> >
> >
> >             and the following Groovy code
> >             <https://www.blazemeter.com/blog/apache-groovy>:
> >
> >             if(!prev.isSuccessful()){
> >             prev.setResponseMessage(prev.getResponseDataAsString())
> >             }
> >
> >
> >
> >
> >             But the result will not be nicely rendered so it worth
> >             adding a listener
> >             like Simple Data Writer
> >             <
> https://jmeter.apache.org/usermanual/component_reference.html#Simple_Data_Writer
> >
> >
> >             instead and configure it to save response data for failing
> >             samplers.
> >
> >
> >
> >
>  ---------------------------------------------------------------------
> >             To unsubscribe, e-mail: user-unsubscr...@jmeter.apache.org
> >             <mailto:user-unsubscr...@jmeter.apache.org>
> >             For additional commands, e-mail:
> >             user-h...@jmeter.apache.org
> >             <mailto:user-h...@jmeter.apache.org>
> >
> Yes, it's possible, you can extract the "interesting" part of the body
> using i.e. Regular Expression Extractor or Boundary Extractor
> <https://www.blazemeter.com/blog/jmeter-boundary-extractor> and store it
> into a JMeter Variable <
> https://jmeter.apache.org/usermanual/functions.html>
>
> Then amend the code to look like:
>
> if(!prev.isSuccessful()){
> prev.setResponseMessage(vars.get('your-variable-name-here'))
> }
>
> where vars is a shorthand for JMeterVariables
> <
> https://jmeter.apache.org/api/org/apache/jmeter/threads/JMeterVariables.html>
>
> class instance.
>
> alternatively you can use Groovy's find operator
> <https://groovy-lang.org/operators.html#_find_operator> against
> prev.getResponseDataAsString() directly.
>

Reply via email to