简体   繁体   English

JMeter:如何在“查看结果树”页面上将内容设置为Java请求样本的请求?

[英]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. 我使用JMeter创建了一个测试计划,该计划包括一个包含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". 但是,当我打开“查看结果树”并为Java请求选择“请求”选项卡时,“没有要显示的数据”。

I want to display a string here, and I did set the string to SampleResult by: 我想在这里显示一个字符串,并通过以下方式将字符串设置为SampleResult:

sampleResult.setRequestHeader(requestString); sampleResult.setRequestHeader(requestString);

However, setting request header seems not to work. 但是,设置请求标头似乎不起作用。

What should I do to display the string in "Request" tab? 如何在“请求”选项卡中显示字符串?

You should 1st choose under classname dropdown menu value org.apache.jmeter.protocol.java.test.JavaTest 您应该首先在classname下拉菜单值org.apache.jmeter.protocol.java.test.JavaTest

Then in the Sampler data field you should input your request data ie I requested this . 然后,在“ Sampler data字段中,应输入您的请求数据,即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. 然后,当您View Results Tree ,当您单击采样器的“ Request选项卡时,您会看到I requested this您先前编写的内容。

在此处输入图片说明

@JuliaLi Click on the check image on the left side of this answer. @JuliaLi单击此答案左侧的检查图像。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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