• Jmeter Html 报告中添加90% line time


    首先上效果图:

    其次明白几个原理:

    1. 90% Line的意思是:一组数由小到大进行排列,找到它的第90%个数;
    2. Jmeter html报告生成是使用xxx.jtl文件通过xsl模板生成的,因此要在html报告中显示90% line,就需要修改xsl模板文件(jmeter-results-detail-report_21.xsl)

    最后上步骤:
    1、在jmeter-results-detail-report_21.xsl添加xsl template,可以放在max 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() 返回当前上下文中的最后一个节点位置数 -->
    				<!-- floor(number) 返回不大于number的最大整数 -->
    				<!-- position() 返回当前节点位置的数字 -->
    				<!-- number(object) 使对象转换成数字 -->
    				<xsl:if test="position() = floor(last()*0.9)">
    					<xsl:value-of select="number(.)" />
    				</xsl:if>
    			</xsl:for-each>
    		</xsl:otherwise>
    	</xsl:choose>
    </xsl:template>
    
    

    2、在Summary中添加90% Line

    <xsl:template name="summary">
    	<h2>Summary</h2>
    	<table align="center" class="details" border="0" cellpadding="5" cellspacing="2" width="95%">
            <tr valign="top">
                <th># Samples</th>
                ...省略N行,添加总结框中的90% Line标题...
                <th>90% Line</th>
            </tr>
                ...省略N行,添加一个xsl变量...
    	    <!-- 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>
    
                ...省略N行,在表格中显示数字...
                <td align="center">
                    <xsl:call-template name="display-time">
                        <xsl:with-param name="value" select="$allLineTime" />
                    </xsl:call-template>
                </td>
    
    

    3、在pagelist中添加90% Line

    <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>
    	            ...省略N行,添加Pages中的90% Line标题...
                        <th>90% Line</th>
    	            <th></th>
                    ...省略N行,添加一个xsl变量...
                    <!-- 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>
                    ...在表格中显示数字...
                    <td align="center">
                        <xsl:call-template name="display-time">
                            <xsl:with-param name="value" select="$nintyTime" />
                        </xsl:call-template>
                    </td>
    
    ~~~~~~~~~~~~~~~~~~~~~~~~~~闲谈莫论人非,静坐常思己过~~~~~~~~~~~~~~~~~~~~~~~~~~
  • 相关阅读:
    查看lwjgl常用状态的值
    微信公众号开发java框架:wx4j(MenuUtils篇)
    微信公众号开发java框架:wx4j(KefuUtils篇)
    微信公众号开发java框架:wx4j(MaterialUtils篇)
    微信公众号开发java框架:wx4j(入门篇)
    hashcode和equals方法小记
    https单向认证和双向认证区别
    java开发中获取路径的一些方式
    iOS使用sqlite3原生语法进行增删改查以及FMDB的使用
    IOS自动布局
  • 原文地址:https://www.cnblogs.com/jaychang/p/5784882.html
Copyright © 2020-2023  润新知