简体   繁体   中英

How can i generate html report in jmeter with response body

I have made these settings in my jmeter.properties file to save my response data when there is a failure

jmeter.save.saveservice.output_format=xml

#jmeter.save.saveservice.response_data=false

jmeter.save.saveservice.response_data.on_error=true

So with these settings i was able to save the responses and view them using jtl file after i run the script from non gui But the problem is with this setting jmeter.save.saveservice.output_format=xml i am unable to generate html report I wanted to generate html report with response body..can someone please help me out

As of JMeter 5.3 you cannot generate HTML reporting dashboard from .jtl files in XML format, according to the documentation:

The dashboard generator is a modular extension of JMeter. Its default behavior is to read and process samples from CSV files to generate HTML files containing graph views. It can generate the report at end of a load test or on demand.

The easiest way of getting the response data into the HTML reporting dashboard is artificially failing the sampler(s) via JSR223 Assertion and setting assertion failure message to be current sampler's response data, example code:

AssertionResult.setFailure(true)
AssertionResult.setFailureMessage(prev.getResponseDataAsString())

You will be able to get something like:

在此处输入图片说明

If this solution is not acceptable you can amend the report-template to represent whatever you want (the knowledge of Java and Freemarker will be required)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM