[英]jmeter HTTP Request get Path from XML element
I try to read XML elements
in order to change the path of the HTTP Request
of the performance test. 我尝试读取
XML elements
,以更改性能测试的HTTP Request
的路径。 My sample XML
data 我的样本
XML
数据
<test>
<paths>
<path>/?test=test1</path>
<path>/?test=test2</path>
</paths>
</test>
Here is the path that I tried to read it through BeanShell
Sampler 这是我尝试通过
BeanShell
Sampler读取它的路径
I would recommend using XPath Extractor for parsing XML data. 我建议使用XPath Extractor解析XML数据。
Demo: 演示:
Example queries: 查询示例:
//path
- match both elements, you can use the output variables with ForEach Controller to hit all endpoints //path
匹配两个元素,您可以将输出变量与ForEach Controller一起使用以击中所有端点 //path[1]
- matches only /?test=test1
//path[1]
-仅匹配/?test=test1
//path[2]
- matches only /?test=test2
//path[2]
-仅匹配/?test=test2
See XPath Tutorial for more information on XPath syntax 有关XPath语法的更多信息,请参见XPath教程 。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.