如何在jmeter的测试报告中显示失败的responseData
Posted
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了如何在jmeter的测试报告中显示失败的responseData相关的知识,希望对你有一定的参考价值。
Failure Detail模块显示Response Data:1、在测试报告模板中(jmeter-results-detail-report_1.0.xsl):
a、设置showData为‘y’
<xsl:param name="showData" select="'y'"/>
<xsl:param name="titleReport" select="'Interface Test Results'"/>
<xsl:param name="dateReport" select="'date not defined'"/>
b、替换内容
<table class="details" border="0" cellpadding="5" cellspacing="2" width="95%">
<tr valign="top">
<th align="center">Response</th>
<th align="center">Failure Message</th>
<xsl:if test="$showData = 'y'">
<th align="left">Response Data</th>
</xsl:if>
</tr>
<xsl:for-each select="/testResults/*[@lb = current()/@lb][attribute::s='false']">
<tr>
<td><xsl:value-of select="@rc | @rs" /> - <xsl:value-of select="@rm" /></td>
<td><xsl:value-of select="assertionResult/failureMessage" /></td>
<xsl:if test="$showData = 'y'">
<td><xsl:value-of select="responseData" /></td>
</xsl:if>
</tr>
</xsl:for-each>
2、在jmeter.properties文件中修改相应的参数
jmeter.save.saveservice.data_type=true
jmeter.save.saveservice.label=true
jmeter.save.saveservice.response_code=true
# response_data is not currently supported for CSV output
jmeter.save.saveservice.response_data=false
# Save ResponseData for failed samples
jmeter.save.saveservice.response_data.on_error=true
jmeter.save.saveservice.response_message=true
jmeter.save.saveservice.successful=true
jmeter.save.saveservice.thread_name=true
jmeter.save.saveservice.time=true
jmeter.save.saveservice.subresults=true
#jmeter.save.saveservice.assertions=true
jmeter.save.saveservice.latency=true
jmeter.save.saveservice.connect_time=false
jmeter.save.saveservice.samplerData=false
jmeter.save.saveservice.responseHeaders=false
jmeter.save.saveservice.requestHeaders=false
jmeter.save.saveservice.encoding=false
jmeter.save.saveservice.bytes=true
jmeter.save.saveservice.url=false
jmeter.save.saveservice.filename=false
jmeter.save.saveservice.hostname=false
jmeter.save.saveservice.thread_counts=true
jmeter.save.saveservice.sample_count=false
jmeter.save.saveservice.idle_time=true 参考技术A Failure Detail模块显示Response Data:
1、在测试报告模板中(jmeter-results-detail-report_1.0.xsl):
a、设置showData为‘y’
<xsl:param name="showData" select="'y'"/>
<xsl:param name="titleReport" select="'Interface Test Results'"/>
<xsl:param name="dateReport" select="'date not defined'"/>
b、替换内容
<table class="details" border="0" cellpadding="5" cellspacing="2" width="95%">
<tr valign="top">
<th align="center">Response</th>
<th align="center">Failure Message</th>
<xsl:if test="$showData = 'y'">
<th align="left">Response Data</th>
</xsl:if>
</tr>
<xsl:for-each select="/testResults/*[@lb = current()/@lb][attribute::s='false']">
<tr>
<td><xsl:value-of select="@rc | @rs" /> - <xsl:value-of select="@rm" /></td>
<td><xsl:value-of select="assertionResult/failureMessage" /></td>
<xsl:if test="$showData = 'y'">
<td><xsl:value-of select="responseData" /></td>
</xsl:if>
</tr>
</xsl:for-each>
2、在jmeter.properties文件中修改相应的参数
jmeter.save.saveservice.data_type=true
jmeter.save.saveservice.label=true
jmeter.save.saveservice.response_code=true
# response_data is not currently supported for CSV output
jmeter.save.saveservice.response_data=false
# Save ResponseData for failed samples
jmeter.save.saveservice.response_data.on_error=true
jmeter.save.saveservice.response_message=true
jmeter.save.saveservice.successful=true
jmeter.save.saveservice.thread_name=true
jmeter.save.saveservice.time=true
jmeter.save.saveservice.subresults=true
#jmeter.save.saveservice.assertions=true
jmeter.save.saveservice.latency=true
jmeter.save.saveservice.connect_time=false
jmeter.save.saveservice.samplerData=false
jmeter.save.saveservice.responseHeaders=false
jmeter.save.saveservice.requestHeaders=false
jmeter.save.saveservice.encoding=false
jmeter.save.saveservice.bytes=true
jmeter.save.saveservice.url=false
jmeter.save.saveservice.filename=false
jmeter.save.saveservice.hostname=false
jmeter.save.saveservice.thread_counts=true
jmeter.save.saveservice.sample_count=false
jmeter.save.saveservice.idle_time=true 参考技术B Failure Detail模块显示Response Data:
1、在测试报告模板中(jmeter-results-detail-report_1.0.xsl):
a、设置showData为‘y’
<xsl:param name="showData" select="'y'"/>
<xsl:param name="titleReport" select="'Interface Test Results'"/>
<xsl:param name="dateReport" select="'date not defined'"/>
b、替换内容
<table class="details" border="0" cellpadding="5" cellspacing="2" width="95%">
<tr valign="top">
<th align="center">Response</th>
<th align="center">Failure Message</th>
<xsl:if test="$showData = 'y'">
<th align="left">Response Data</th>
</xsl:if>
</tr>
<xsl:for-each select="/testResults/*[@lb = current()/@lb][attribute::s='false']">
<tr>
<td><xsl:value-of select="@rc | @rs" /> - <xsl:value-of select="@rm" /></td>
<td><xsl:value-of select="assertionResult/failureMessage" /></td>
<xsl:if test="$showData = 'y'">
<td><xsl:value-of select="responseData" /></td>
</xsl:if>
</tr>
</xsl:for-each>
2、在jmeter.properties文件中修改相应的参数
jmeter.save.saveservice.data_type=true
jmeter.save.saveservice.label=true
jmeter.save.saveservice.response_code=true
# response_data is not currently supported for CSV output
jmeter.save.saveservice.response_data=false
# Save ResponseData for failed samples
jmeter.save.saveservice.response_data.on_error=true
jmeter.save.saveservice.response_message=true
jmeter.save.saveservice.successful=true
jmeter.save.saveservice.thread_name=true
jmeter.save.saveservice.time=true
jmeter.save.saveservice.subresults=true
#jmeter.save.saveservice.assertions=true
jmeter.save.saveservice.latency=true
jmeter.save.saveservice.connect_time=false
jmeter.save.saveservice.samplerData=false
jmeter.save.saveservice.responseHeaders=false
jmeter.save.saveservice.requestHeaders=false
jmeter.save.saveservice.encoding=false
jmeter.save.saveservice.bytes=true
jmeter.save.saveservice.url=false
jmeter.save.saveservice.filename=false
jmeter.save.saveservice.hostname=false
jmeter.save.saveservice.thread_counts=true
jmeter.save.saveservice.sample_count=false
jmeter.save.saveservice.idle_time=true
如果超过阈值,JMeter 会失败测试
【中文标题】如果超过阈值,JMeter 会失败测试【英文标题】:JMeter fail tests if threshold exceeded 【发布时间】:2016-10-17 07:53:24 【问题描述】:我希望我能在这里找到帮助,因为我在互联网上没有找到任何东西。我有多个 JMeter 计划,如果超过一组请求的吞吐量阈值,我想使计划失败。如何从 JMeter 获取真正的阈值,如果超过则无法通过测试。我需要为每个请求执行此操作,例如每个请求组的摘要报告中显示的阈值。 提前谢谢你。
【问题讨论】:
【参考方案1】:你不能让“计划”失败,你只能让一个使用Assertion的采样器失败
选项在:
-
如果平均响应时间超过阈值,则使用 JMeter AutoStop Plugin 停止测试。测试完成后,您可以将预期持续时间与实际持续时间进行比较,如果它更少 - 说明测试以某种方式失败(即返回非零退出代码
使用Taurus 工具作为JMeter 测试的包装器,您可以使用Pass/Fail Criteria 子系统设置所需的故障条件。如果满足指定的标准,Taurus 将自动通过测试。
【讨论】:
以上是关于如何在jmeter的测试报告中显示失败的responseData的主要内容,如果未能解决你的问题,请参考以下文章