好吧,让我们从第一步开始:
Right click -> Add -> Threads (Users) -> Thread Group
- 现在是实际的第一步(如果使用REST):
Add -> Sampler -> Http Request
您在底部
Send Files With the Request。您可以根据需要添加文件附件。
- 从服务器提取响应:
假设您的答复是这样的:
<Response> <name>StackOverflow.com</name> <url>http://stackoverflow.com/questions/11186423/how-to-parse-response-of-sample1-to-create-new-sample-in-jmeter</url></Response>
这是您的工作:
Right click on The http request you previously added (in step 1) -> PostProcessors -> Xpath Extractor
Reference Name是要在其中存储值的变量的名称。命名吧
url。并且
Xpathquery是
Response/url还是
//Response/url如果您获得更多响应标签。如果要第一个
//Response[1]/url,依此类推。
- 重复步骤1(复制/粘贴采样器并删除
Xpath Extractor
不再需要的采样器),然后将更Server Name or IP
改为${url}先前返回的值。
Voila,你去了。让我知道您是否还有其他具体问题。Jmeter很有趣。
Per Grace评论:
要提取
https://192.168.100.46/updserver/download?action=signature_download&token=
超出响应数据:
<responseData ><html>
<body>
ERROR=0
MSG=N/A
FILELIST=1555;1340778737370;1526545487;
VERSION=1.002
URL=https://192.168.100.46/updserver/download?action=signature_download&token=
INTERVAL=0
</body>
</html>
</responseData>
这应该很简单。
Add a post processor -> Regular expression Extractor并放置以下内容:
Reference Name : url Regular expression : (http[S]+)Template : $1$Match No. (0 for Random): 1
因此,现在有了
url变量,您可以在测试中进一步使用它
${url}。让我知道这是否适合您。我用虚拟采样器测试过,它对我有用。


