我想从 Jmeter 中给定的 xml 响应中提取所有 orderNumber 值
I wanted to extract the all the orderNumber values from given xml response in Jmeter
我想从 JMeter 中给定的 XML 响应中提取所有 orderNumber 值
我正在使用的正则表达式:orderNumber=(".*?")
Xml:
<?xml version="1.0" encoding="UTF-8"?>
<ReportExecuted ReportId="4130" >
<DisplayName>Partner Asset - Landing Page (No Glis Orders) Descending</DisplayName>
<ExecutedBy>admin</ExecutedBy>
<ExecutionTime>Thu Nov 16 07:32:29 UTC 2017</ExecutionTime>
<PageNumber>1</PageNumber>
<PageSize>10</PageSize>
<DisplayRecords>1 to 10</DisplayRecords>
<TotalRecords>1000</TotalRecords>
<ReportContent>
<![CDATA[
<partnerAssetLandingPage orderNumber="AutoSoapEONID11486" orderDate="2017-07-20T00:00:00"/><partnerAssetLandingPage orderNumber="AutoOrder101" orderDate="2016-11-04T00:00:00"/>
]]>
</ReportContent>
</ReportExecuted>
运行Jmeter 后的响应:
我只得到第一个订单编号值,但我想要所有订单无值
您的正则表达式没问题,您应该将 Match No.
更新为 -1(或负数),然后通过参考名称更新 get all the values 例如 orderNumber - 使用 orderNumber_1,orderNumber_2,...
If the match number is set to a negative number, then all the possible matches in the sampler data are processed. The variables are set as follows:
refName_matchNr - the number of matches found; could be 0
refName_n, where n = 1, 2, 3 etc. - the strings as generated by the template
refName_n_gm, where m=0, 1, 2 - the groups for match n
refName - always set to the default value
refName_gn - not set
Note that the refName variable is always set to the default value in this case, and the associated group variables are not set.
您可以使用 ForEach Controller
It is especially suited for running with the regular expression post-processor.
This can "create" the necessary input variables out of the result data of a previous request. By omitting the "_" separator, the ForEach Controller can be used to loop through the groups by using the input variable refName_g, and can also loop through all the groups in all the matches by using an input variable of the form refName_${C}_g, where C is a counter variable.
我想从 JMeter 中给定的 XML 响应中提取所有 orderNumber 值
我正在使用的正则表达式:orderNumber=(".*?")
Xml:
<?xml version="1.0" encoding="UTF-8"?>
<ReportExecuted ReportId="4130" >
<DisplayName>Partner Asset - Landing Page (No Glis Orders) Descending</DisplayName>
<ExecutedBy>admin</ExecutedBy>
<ExecutionTime>Thu Nov 16 07:32:29 UTC 2017</ExecutionTime>
<PageNumber>1</PageNumber>
<PageSize>10</PageSize>
<DisplayRecords>1 to 10</DisplayRecords>
<TotalRecords>1000</TotalRecords>
<ReportContent>
<![CDATA[
<partnerAssetLandingPage orderNumber="AutoSoapEONID11486" orderDate="2017-07-20T00:00:00"/><partnerAssetLandingPage orderNumber="AutoOrder101" orderDate="2016-11-04T00:00:00"/>
]]>
</ReportContent>
</ReportExecuted>
运行Jmeter 后的响应: 我只得到第一个订单编号值,但我想要所有订单无值
您的正则表达式没问题,您应该将 Match No.
更新为 -1(或负数),然后通过参考名称更新 get all the values 例如 orderNumber - 使用 orderNumber_1,orderNumber_2,...
If the match number is set to a negative number, then all the possible matches in the sampler data are processed. The variables are set as follows:
refName_matchNr - the number of matches found; could be 0
refName_n, where n = 1, 2, 3 etc. - the strings as generated by the template
refName_n_gm, where m=0, 1, 2 - the groups for match n
refName - always set to the default value
refName_gn - not set
Note that the refName variable is always set to the default value in this case, and the associated group variables are not set.
您可以使用 ForEach Controller
It is especially suited for running with the regular expression post-processor.
This can "create" the necessary input variables out of the result data of a previous request. By omitting the "_" separator, the ForEach Controller can be used to loop through the groups by using the input variable refName_g, and can also loop through all the groups in all the matches by using an input variable of the form refName_${C}_g, where C is a counter variable.