【发布时间】:2019-09-06 04:55:17
【问题描述】:
我尝试使用标准 jmeter 报告模板 XSL(jmeter-results-detail-report_21.xsl) 生成 jmeter 报告,但不知何故,报告无法将 httpSample/httpSample 的子子项显示为 httpSample 的细分。
是否有将子 httpSample/httpSample 结果显示为其父 httpSample 的细分?
我有一个想法,将子 lb 值替换为其父 lb 值,以使其独一无二。但是我是 java/regex/XSL 的新手,我该怎么做呢?
below is original jtl
<sample t="1605" it="15032" lt="0" ct="0" ts="1567595832665" s="true" lb="A02 Landing" rc="200" rm="Number of samples in transaction : 3, number of failing samples : 0" tn="Thread Group 1-1" dt="" by="70695" sby="3136" ng="2" na="2">
<httpSample t="649" it="0" lt="629" ct="440" ts="1567595837679" s="true" lb="A02.01 /abcd/login.action?do=Login" rc="200" rm="OK" tn="Thread Group 1-1" dt="text" by="2094" sby="1671" ng="2" na="2">
<httpSample t="629" it="0" lt="629" ct="440" ts="1567595837679" s="true" lb="https://10.111.11.111:7351/abcd/login.action?do=Login" rc="302" rm="Moved Temporarily" tn="Thread Group 1-1" dt="text" by="856" sby="1001" ng="2" na="2"/>
<httpSample t="18" it="0" lt="18" ct="0" ts="1567595838310" s="true" lb="https://10.111.11.111:7351/abcd/HandlerInit.action?do=Redirect" rc="200" rm="OK" tn="Thread Group 1-1" dt="text" by="1238" sby="670" ng="2" na="2"/>
</httpSample>
<httpSample t="549" it="0" lt="533" ct="137" ts="1567595843333" s="true" lb="A02.02 /abcd/HandlerLogin.action?do=InitLoad" rc="200" rm="OK" tn="Thread Group 1-1" dt="text" by="34332" sby="794" ng="2" na="2"/>
<httpSample t="407" it="0" lt="402" ct="332" ts="1567595848894" s="true" lb="A02.03 /abcd/message_board.action" rc="200" rm="OK" tn="Thread Group 1-1" dt="text" by="34269" sby="671" ng="2" na="2"/>
</sample>
<sample t="5863" it="15038" lt="0" ct="0" ts="1567595835027" s="true" lb="A03 Landing 2" rc="200" rm="Number of samples in transaction : 3, number of failing samples : 0" tn="Thread Group 1-2" dt="" by="70695" sby="3136" ng="2" na="2">
<httpSample t="609" it="0" lt="290" ct="142" ts="1567595840037" s="true" lb="A03.01 /abcd/login.action?do=Login2" rc="200" rm="OK" tn="Thread Group 1-2" dt="text" by="2094" sby="1671" ng="2" na="2">
<httpSample t="290" it="0" lt="290" ct="142" ts="1567595840037" s="true" lb="https://10.111.11.111:7351/abcd/login.action?do=Login2" rc="302" rm="Moved Temporarily" tn="Thread Group 1-2" dt="text" by="856" sby="1001" ng="2" na="2"/>
<httpSample t="318" it="0" lt="318" ct="0" ts="1567595840328" s="true" lb="https://10.111.11.111:7351/abcd/HandlerInit.action?do=Redirect2" rc="200" rm="OK" tn="Thread Group 1-2" dt="text" by="1238" sby="670" ng="2" na="2"/>
</httpSample>
<httpSample t="2064" it="0" lt="1323" ct="342" ts="1567595845660" s="true" lb="A03.02 /abcd/HandlerLogin.action?do=InitLoad" rc="200" rm="OK" tn="Thread Group 1-2" dt="text" by="34332" sby="794" ng="2" na="2"/>
<httpSample t="3190" it="0" lt="1302" ct="333" ts="1567595852737" s="true" lb="A03.03 /abcd/message_board.action" rc="200" rm="OK" tn="Thread Group 1-2" dt="text" by="34269" sby="671" ng="2" na="2"/>
</sample>
expected result as below. It's will be few hundred thousand row need to be replace. Is there any way to replace it?
<sample t="1605" it="15032" lt="0" ct="0" ts="1567595832665" s="true" lb="A02 Landing" rc="200" rm="Number of samples in transaction : 3, number of failing samples : 0" tn="Thread Group 1-1" dt="" by="70695" sby="3136" ng="2" na="2">
<httpSample t="649" it="0" lt="629" ct="440" ts="1567595837679" s="true" lb="A02.01 /abcd/login.action?do=Login" rc="200" rm="OK" tn="Thread Group 1-1" dt="text" by="2094" sby="1671" ng="2" na="2">
<httpSample t="629" it="0" lt="629" ct="440" ts="1567595837679" s="true" lb="A02.01 https://10.111.11.111:7351/abcd/login.action?do=Login" rc="302" rm="Moved Temporarily" tn="Thread Group 1-1" dt="text" by="856" sby="1001" ng="2" na="2"/>
<httpSample t="18" it="0" lt="18" ct="0" ts="1567595838310" s="true" lb="A02.01 https://10.111.11.111:7351/abcd/HandlerInit.action?do=Redirect" rc="200" rm="OK" tn="Thread Group 1-1" dt="text" by="1238" sby="670" ng="2" na="2"/>
</httpSample>
<httpSample t="549" it="0" lt="533" ct="137" ts="1567595843333" s="true" lb="A02.02 /abcd/HandlerLogin.action?do=InitLoad" rc="200" rm="OK" tn="Thread Group 1-1" dt="text" by="34332" sby="794" ng="2" na="2"/>
<httpSample t="407" it="0" lt="402" ct="332" ts="1567595848894" s="true" lb="A02.03 /abcd/message_board.action" rc="200" rm="OK" tn="Thread Group 1-1" dt="text" by="34269" sby="671" ng="2" na="2"/>
</sample>
<sample t="5863" it="15038" lt="0" ct="0" ts="1567595835027" s="true" lb="A03 Landing 2" rc="200" rm="Number of samples in transaction : 3, number of failing samples : 0" tn="Thread Group 1-2" dt="" by="70695" sby="3136" ng="2" na="2">
<httpSample t="609" it="0" lt="290" ct="142" ts="1567595840037" s="true" lb="A03.01 /abcd/login.action?do=Login2" rc="200" rm="OK" tn="Thread Group 1-2" dt="text" by="2094" sby="1671" ng="2" na="2">
<httpSample t="290" it="0" lt="290" ct="142" ts="1567595840037" s="true" lb="A03.01 https://10.111.11.111:7351/abcd/login.action?do=Login2" rc="302" rm="Moved Temporarily" tn="Thread Group 1-2" dt="text" by="856" sby="1001" ng="2" na="2"/>
<httpSample t="318" it="0" lt="318" ct="0" ts="1567595840328" s="true" lb="A03.01 https://10.111.11.111:7351/abcd/HandlerInit.action?do=Redirect2" rc="200" rm="OK" tn="Thread Group 1-2" dt="text" by="1238" sby="670" ng="2" na="2"/>
</httpSample>
<httpSample t="2064" it="0" lt="1323" ct="342" ts="1567595845660" s="true" lb="A03.02 /abcd/HandlerLogin.action?do=InitLoad" rc="200" rm="OK" tn="Thread Group 1-2" dt="text" by="34332" sby="794" ng="2" na="2"/>
<httpSample t="3190" it="0" lt="1302" ct="333" ts="1567595852737" s="true" lb="A03.03 /abcd/message_board.action" rc="200" rm="OK" tn="Thread Group 1-2" dt="text" by="34269" sby="671" ng="2" na="2"/>
</sample>
【问题讨论】:
-
您最好不要在这里使用正则表达式,而应该使用 XML 解析器(Java 有许多很好的库可以做到这一点)。
-
你好,蒂姆,Java 是个好主意。但是 XML 解析器如何知道 httpSample 有子子项并用它的父 lb 值替换。并非所有的 httpSample 都有子标签,只有那些 httpSample 包含子标签的才会被父标签替换。
标签: java regex xml jmeter xml-parsing