简体   繁体   中英

Unable to see Response Body in JMeter, View Results Tree listener

When I run a Http Request, to a page that should return a response body (I know it's working because I already tried in Postman). When I execute the sampler it's sends a 200 OK code, but the response body in the View Results Tree Listener, is empty. Why does this happen?

I use MAC OS, and I installed JMeter with Brew. I've already tried to add the following information in the user.properties file:

jmeter.save.saveservice.output_format=xml
jmeter.save.saveservice.response_data=true
jmeter.save.saveservice.samplerData=true
jmeter.save.saveservice.requestHeaders=true
jmeter.save.saveservice.url=true
jmeter.save.saveservice.responseHeaders=true

It looks like this:

在此处输入图片说明

The changes you've made don't have any impact onto View Results Tree listener output, they are only for .jtl results files.

Try the following:

  1. Run your JMeter test in command-line non-GUI mode like

     jmeter -n -t test.jmx -l result.xml 

    and open result.xml file with your faviourite text or XML viewer/editor. You should see something like:

     <?xml version="1.0" encoding="UTF-8"?> <testResults version="1.2"> <httpSample t="93" it="0" lt="93" ct="42" ts="1568029799118" s="true" lb="HTTP Request" rc="200" rm="OK" tn="Thread Group 1-1" dt="text" by="759" sby="139" ng="1" na="1"> <responseData class="java.lang.String">{ &quot;userId&quot;: 1, &quot;id&quot;: 1, &quot;title&quot;: &quot;delectus aut autem&quot;, &quot;completed&quot;: false }</responseData> <java.net.URL>http://jsonplaceholder.typicode.com/todos/1</java.net.URL> </httpSample> </testResults> 

    where responseData tag contains XML-escaped response data. If there is some data in the file - most probably something is wrong with your JMeter installation, try re-installing it by downloading JMeter from the official website as the Brew package might be broken.

  2. Check jmeter.log file contents , if anything goes wrong JMeter normally writes a log message with the results.

I had this exact issue, and the final answer was to use either Java version 9 or in my case it was Java version 8. That fixed the issue and I am now able to see the response body and response headers. 在此处输入图片说明

I see you didn't load the generated *.jtl file in your "View results Tree" panel. You should browse and open that file and then you can see the results. Remember, you must add the listener, run the tests in non-GUI mode once, and the *.jtl file would then contain the results. Open them here:

在此处输入图片说明

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