<output id="qn6qe"></output>

    1. <output id="qn6qe"><tt id="qn6qe"></tt></output>
    2. <strike id="qn6qe"></strike>

      亚洲 日本 欧洲 欧美 视频,日韩中文字幕有码av,一本一道av中文字幕无码,国产线播放免费人成视频播放,人妻少妇偷人无码视频,日夜啪啪一区二区三区,国产尤物精品自在拍视频首页,久热这里只有精品12

      Jmeter Html 報告優化

      但是最近在查閱相關資料時,發現基本都是重復一篇文章Jmeter使用筆記之html報告擴展(一),而且有很多看不明白的地方,于是根據自己需求,在報告中修改了一些,現在整理分享出來。

      優化后效果圖:

      1. 郵件發送html報告有中文時,顯示亂碼:

      修改encoding為“UTF-8”

      <xsl:output method="html" indent="yes" encoding="UTF-8" doctype-public="-//W3C//DTD HTML 4.01 Transitional//EN" />
      

      2. Summary中的只標紅Failures數:

      • 屏蔽Summary中class屬性
      			<!-- 			
      			<xsl:attribute name="class">
      				<xsl:choose>
      					<xsl:when test="$allFailureCount &gt; 0">Failure</xsl:when>
      				</xsl:choose>
      			</xsl:attribute> 
      			-->
      
      • 修改allFailureCount
      			<td align="center">
      				<xsl:value-of select="$allSuccessCount" />
      			</td>
      			<xsl:choose>
      				<xsl:when test="$allFailureCount &gt; 0">
      					<td align="center" style="font-weight:bold">
      						<font color="red">
      							<xsl:value-of select="$allFailureCount" />
      						</font>
      					</td>
      				</xsl:when>
      				<xsl:otherwise>
                  		<td align="center">
      						<xsl:value-of select="$allFailureCount" />
      					</td>
                		</xsl:otherwise>
      			</xsl:choose>
      

      3. Pages頁面按Average Time倒序排序:

      在Pagelist模板中for-each下添加

      <xsl:for-each select="/testResults/*[not(@lb = preceding::*/@lb)]"	>
      			<!-- 按平均時間排序 -->
      			<xsl:sort select="sum(../*[@lb = current()/@lb]/@t) div count(../*[@lb = current()/@lb])" data-type="number" order="descending"/>
      

      4. 接口Average Time超過2s標黃顯示:

      • 添加LongTime css
      				.Failure {
      					font-weight:bold; color:red;
      				}
      				.LongTime {
      					font-weight:bold; color:#ff9900;
      				}
      				
      
      • Pagelist 模塊中針對錯誤和超長時間接口標色顯示
      			<tr valign="top">
      				<xsl:choose>
      					<!-- 失敗用例標紅顯示 -->
      					<xsl:when test="$failureCount &gt; 0">
      						<xsl:attribute name="class">
      							<xsl:choose>
      								<xsl:when test="$failureCount &gt; 0">Failure</xsl:when>
      							</xsl:choose>
      						</xsl:attribute>
      	          		</xsl:when>
      					<!-- 平均時間超過2s,標色顯示 -->
      					<xsl:when test="$averageTime &gt; 2000">
      						<xsl:attribute name="class">
      							<xsl:choose>
      								<xsl:when test="$averageTime &gt; 2000">LongTime</xsl:when>
      							</xsl:choose>
      						</xsl:attribute>
      					</xsl:when>
      				</xsl:choose>
      

      5. 添加90% Line和QPS:

      • 添加90 %lineTime模板
      <xsl:template name="max">
      	<xsl:param name="nodes" select="/.." />
      	<xsl:choose>
      		<xsl:when test="not($nodes)">NaN</xsl:when>
      		<xsl:otherwise>
      			<xsl:for-each select="$nodes">
      				<xsl:sort data-type="number" order="descending" />
      				<xsl:if test="position() = 1">
      					<xsl:value-of select="number(.)" />
      				</xsl:if>
      			</xsl:for-each>
      		</xsl:otherwise>
      	</xsl:choose>
      </xsl:template>
      
      <!-- 90% line time -->
      <xsl:template name="lineTime">
      	<xsl:param name="nodes" select="/.." />
      	<xsl:choose>
      		<xsl:when test="not($nodes)">NaN</xsl:when>
      		<xsl:otherwise>
      			<xsl:for-each select="$nodes">
      				<xsl:sort data-type="number" />
      				<!-- last() 返回當前上下文中的最后一個節點位置數 -->
      				<!-- ceiling(number) 返回大于number的最小整數 -->
      				<!-- floor(number) 返回不大于number的最大整數 -->
      				<!-- position() 返回當前節點位置的數字 -->
      				<!-- number(object) 使對象轉換成數字 -->
      				<xsl:choose>
                          <!-- 當只有一個節點時,向上取整 -->
                          <xsl:when test="last() = 1">
                             	<xsl:if test="position() = ceiling(last()*0.9)">
                                  <xsl:value-of select="number(.)" />
                              </xsl:if>
                          </xsl:when>
                          <xsl:otherwise>
                              <xsl:if test="position() = floor(last()*0.9)">
                                  <xsl:value-of select="number(.)" />
                              </xsl:if>
                            </xsl:otherwise>
                      </xsl:choose>
      			</xsl:for-each>
      		</xsl:otherwise>
      	</xsl:choose>
      </xsl:template>
      
      
      • Sunmary中添加標題
      		<tr valign="top">
      			<th># Samples</th>
      			<th>Success</th>
      			<th>Failures</th>
      			<th>Success Rate</th>
      			<th>Average Time</th>
      			<th>Min Time</th>
      			<th>Max Time</th>
      			<th>90% Line</th>
      			<th>QPS</th>
      		</tr>
      
      • Summary中添加allLineTime和qps變量
      			<xsl:variable name="allMaxTime">
      				<xsl:call-template name="max">
      					<xsl:with-param name="nodes" select="/testResults/*/@t" />
      				</xsl:call-template>
      			</xsl:variable>
      			<!-- New add 90% line -->
      			<xsl:variable name="allLineTime">
      			    <xsl:call-template name="lineTime">
      			        <xsl:with-param name="nodes" select="/testResults/*/@t" />
      			    </xsl:call-template>
      			</xsl:variable>
      			<!-- 將毫秒轉換成秒 -->
      			<xsl:variable name="qps" select="$allCount * 1000 div $allTotalTime"/>
      
      • Summary中調用allLineTime和qps變量
      			<td align="center">
      				<xsl:call-template name="display-time">
      					<xsl:with-param name="value" select="$allMaxTime" />
      				</xsl:call-template>
      			</td>
      			<td align="center">
      				<xsl:call-template name="display-time">
      					<xsl:with-param name="value" select="$allLineTime" />
      				</xsl:call-template>
      			</td>
      			<td align="center">
      				<xsl:call-template name="display-qps">
      					<xsl:with-param name="value" select="$qps" />
      				</xsl:call-template>
      
      • pagelist中添加標題
      <xsl:template name="pagelist">
      	<h2>Pages</h2>
      	<table align="center" class="details" border="0" cellpadding="5" cellspacing="2" width="95%">
      		<tr valign="top">
      			<th>URL</th>
      			<th># Samples</th>
      			<th>Success</th>
      			<th>Failures</th>
      			<th>Success Rate</th>
      			<th>Average Time</th>
      			<th>Min Time</th>
      			<th>Max Time</th>
      			<th>90% Line</th>
      			<th>QPS</th>
      			<th></th>
      		</tr>
      
      • pagelist中添加allLineTime和qps變量
      			<xsl:variable name="maxTime">
      				<xsl:call-template name="max">
      					<xsl:with-param name="nodes" select="../*[@lb = current()/@lb]/@t" />
      				</xsl:call-template>
      			</xsl:variable>
      			<!-- new add 90% line time -->
      			<xsl:variable name="nintyTime">
      				<xsl:call-template name="lineTime">
      					<xsl:with-param name="nodes" select="../*[@lb = current()/@lb]/@t" />
      				</xsl:call-template>
      			</xsl:variable>
      			<xsl:variable name="qpsTime" select="$count * 1000 div $totalTime"/>
      
      • pagelist中調用allLineTime和qps變量
      				<td align="center">
      					<xsl:call-template name="display-time">
      						<xsl:with-param name="value" select="$maxTime" />
      					</xsl:call-template>
      				</td>
      				<!-- Page頁面添加90% LineTime -->
      				<td align="center">
      					<xsl:call-template name="display-time">
      						<xsl:with-param name="value" select="$nintyTime" />
      					</xsl:call-template>
      				</td>
      				<td align="center">
      					<xsl:call-template name="display-qps">
      						<xsl:with-param name="value" select="$qpsTime" />
      					</xsl:call-template>
      				</td>
      

      6.Failure Detail模塊顯示Response Data:

      • 設置showData為‘y’
      <!-- Defined parameters (overrideable) -->
      <xsl:param    name="showData" select="'y'"/>
      <xsl:param    name="titleReport" select="'Interface Test Results'"/>
      <xsl:param    name="dateReport" select="'date not defined'"/>
      
      
      • 替換內容
      				<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>
      

      7.添加Host

      <xsl:template name="pageHeader">
      	<h1><xsl:value-of select="$titleReport" /></h1>
      	<table width="100%">
      		<tr>
      			<!-- 獲取requestHeader數據 -->
      			<xsl:variable name="req" select="/testResults/httpSample/requestHeader" />
      			<!-- 從獲取的URL中截取數據,以Host:分割,取后半部分 -->
      			<xsl:variable name="remaining" select="substring-after($req,'Host:')" /> 	
      			<!-- 已換行符來截取,before代表換行符之前的數據 -->
      			<xsl:variable name="host" select="substring-before($remaining, '&#xA;')" /> 
      			<td align="left">Date report: <xsl:value-of select="$dateReport" /></td>
      			<td align="center">Host: <xsl:value-of select="$host" /></td>
      			<td align="right"><a href="./TestLog.html">測試日志</a></td>
      		</tr>
      	</table>
      	<hr size="1" />
      </xsl:template>
      
      
      ### 8.文件下載:[jmeter-results-detail-report_30.xsl](https://pan.baidu.com/s/1gfvIVNt)
      posted @ 2016-09-18 14:37  南風_real  閱讀(4180)  評論(0)    收藏  舉報
      主站蜘蛛池模板: 亚洲成av人最新无码不卡短片| 亚洲熟少妇在线播放999| 国产不卡一区二区四区| 久久久国产成人一区二区| 不卡乱辈伦在线看中文字幕| 国产精品国产三级在线专区| 久热这里有精品免费视频| 久久热这里只有精品99| 亚洲性夜夜天天天| 亚洲大尺度无码专区尤物| 九九色这里只有精品国产| 国内精品久久久久影院网站| 宅男噜噜噜66在线观看| 毛片av在线尤物一区二区| 久久精品蜜芽亚洲国产av| 成在人线av无码免费看网站直播| 2021AV在线无码最新| 久久影院九九被窝爽爽| 亚洲国内精品一区二区| 国产一区二区三中文字幕| 亚洲av产在线精品亚洲第一站 | 中文成人在线| 免费无码av片在线观看网站| 中文午夜乱理片无码| 日日噜噜噜夜夜爽爽狠狠视频 | 无套内谢少妇高清毛片| 亚洲av日韩av永久无码电影| 人妻中出无码一区二区三区| 久久天天躁夜夜躁狠狠85| 一本色道久久加勒比综合| 久久天堂综合亚洲伊人HD妓女| 美女内射无套日韩免费播放| 福利一区二区1000| 日本夜爽爽一区二区三区| 亚洲熟女综合色一区二区三区| 亚洲小说乱欧美另类| 国产极品美女高潮抽搐免费网站 | 亚洲男人在线天堂| 国产精品色悠悠在线观看| 热久在线免费观看视频| 国产精品人妻熟女男人的天堂|