jmeterviewresult

JMeter: How to set content to the request of a Java Request Sample on "View Results Tree" page?


I created a test plan with JMeter, and this plan include a Thread Group which contains 2 Java Request Sample. The plan runs successfully. But when I open the "View Results Tree", and select the "Request" tab for a Java request, there is "no data to display".

I want to display a string here, and I did set the string to SampleResult by:

sampleResult.setRequestHeader(requestString);

However, setting request header seems not to work.

What should I do to display the string in "Request" tab?


Solution

  • You should 1st choose under classname dropdown menu value org.apache.jmeter.protocol.java.test.JavaTest

    Then in the Sampler data field you should input your request data i.e I requested this.

    And then when you look at the result from View Results Tree , when you click on your sampler Request tab there you'll see I requested this which you previously wrote.

    enter image description here

    @JuliaLi Click on the check image on the left side of this answer.