我一直在 JMeter 中运行一系列 Web 服务测试,我一直在修改我的结果报告以包含每个测试返回的平均响应时间的总和。但我还需要做的是取平均值的总和,直到某个测试。有没有办法我可以修改 XSLT 来总结每个测试的测试平均值,除了测试“X”和它之后的那些?例如 lb="getSubscribers"?
以下是结果报告通常的样子。本质上,我想将“http”测试中的“平均时间”列的内容与“AlarmMgmtWSDL”测试相加。
这是我来自 JMeter 的 XML:
<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" href="../style/jmeter-results-detail-report_21.xsl"?>
<testResults version="1.2">
<httpSample t="78" lt="78" ts="1338826079163" s="true" lb="html" rc="200" rm="OK" tn="vuserver 1-1" dt="text" by="4418" ng="1" na="1"/>
<httpSample t="31" lt="31" ts="1338826079241" s="true" lb="userRoleRetriever" rc="200" rm="OK" tn="vuserver 1-1" dt="text" by="758" ng="1" na="1"/>
<httpSample t="32" lt="32" ts="1338826079272" s="true" lb="UserActivityWSDL" rc="200" rm="OK" tn="vuserver 1-1" dt="text" by="2398" ng="1" na="1"/>
<httpSample t="156" lt="125" ts="1338826079304" s="true" lb="SubscriberMgmtWSDL" rc="200" rm="OK" tn="vuserver 1-1" dt="text" by="56434" ng="1" na="1"/>
<httpSample t="31" lt="16" ts="1338826079460" s="true" lb="NetworkMgmtWSDL" rc="200" rm="OK" tn="vuserver 1-1" dt="text" by="33020" ng="1" na="1"/>
<httpSample t="15" lt="15" ts="1338826079507" s="true" lb="AlarmMgmtWSDL" rc="200" rm="OK" tn="vuserver 1-1" dt="text" by="11594" ng="1" na="1"/>
<httpSample t="141" lt="141" ts="1338826079538" s="true" lb="getSubscribers" rc="200" rm="OK" tn="vuserver 1-1" dt="text" by="397" ng="1" na="1"/>
<httpSample t="265" lt="234" ts="1338826079679" s="true" lb="getMpegResultsById" rc="200" rm="OK" tn="vuserver 1-1" dt="text" by="832927" ng="1" na="1"/>
<httpSample t="15" lt="15" ts="1338826079976" s="true" lb="getOverallSummary" rc="200" rm="OK" tn="vuserver 1-1" dt="text" by="402" ng="1" na="1"/>
<httpSample t="0" lt="0" ts="1338826082663" s="true" lb="html" rc="200" rm="OK" tn="vuserver 1-2" dt="text" by="4418" ng="1" na="1"/>
<httpSample t="16" lt="16" ts="1338826082663" s="true" lb="userRoleRetriever" rc="200" rm="OK" tn="vuserver 1-2" dt="text" by="758" ng="1" na="1"/>
<httpSample t="15" lt="0" ts="1338826082679" s="true" lb="UserActivityWSDL" rc="200" rm="OK" tn="vuserver 1-2" dt="text" by="2398" ng="1" na="1"/>
<httpSample t="32" lt="0" ts="1338826082694" s="true" lb="SubscriberMgmtWSDL" rc="200" rm="OK" tn="vuserver 1-2" dt="text" by="56434" ng="1" na="1"/>
<httpSample t="31" lt="15" ts="1338826082726" s="true" lb="NetworkMgmtWSDL" rc="200" rm="OK" tn="vuserver 1-2" dt="text" by="33020" ng="1" na="1"/>
<httpSample t="16" lt="16" ts="1338826082757" s="true" lb="AlarmMgmtWSDL" rc="200" rm="OK" tn="vuserver 1-2" dt="text" by="11594" ng="1" na="1"/>
<httpSample t="250" lt="250" ts="1338826082788" s="true" lb="getSubscribers" rc="200" rm="OK" tn="vuserver 1-2" dt="text" by="10536" ng="1" na="1"/>
<httpSample t="15454" lt="15392" ts="1338826083038" s="true" lb="getMpegResultsById" rc="200" rm="OK" tn="vuserver 1-2" dt="text" by="2023426" ng="1" na="1"/>
<httpSample t="15" lt="15" ts="1338826098555" s="true" lb="getOverallSummary" rc="200" rm="OK" tn="vuserver 1-2" dt="text" by="402" ng="1" na="1"/>
</testResults>
我需要处理来自该 XML 的前 X 个测试结果,排除其余测试结果,同时在第二次迭代时保留 X 个测试结果,以便我可以取平均值。
这是我的 xslt 的摘录,它找到了测试平均值的总和:
<xsl:variable name="totalAverageTime">
<xsl:for-each-group select="httpSample" group-by="@lb">
<xsl:variable name="count" select="count(current-group())" />
<xsl:variable name="totalTime" select="sum(current-group()/@t)" />
<average avg="{$totalTime div $count}" />
</xsl:for-each-group>
</xsl:variable>
<tr>
<td>
<xsl:call-template name="display-time">
<xsl:with-param name="value" select="sum($totalAverageTime/average/@avg)" />
</xsl:call-template>
</td>
</tr>
关于如何使用这些特定测试的任何想法?帮助将不胜感激!