zoukankan      html  css  js  c++  java
  • Jmeter html 报告中添加90% line time

    转载南风_real博客园:http://www.cnblogs.com/jaychang/p/5784882.html

    首先上效果图:

    其次明白几个原理:

    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>
  • 相关阅读:
    qt creator中输入中文中文变繁体
    Trie
    pycharm 专业版的 django功能
    fzu 1533
    django使用问题记录
    查看SQLServer最耗资源时间的SQL语句
    从mysql数据库删除重复记录只保留其中一条(保留id最小的一条)
    使用CSS3的appearance属性改变元素的外观
    mysql中将多行数据合并成一行数据
    MySQL字符串的拼接、截取、替换、查找位置
  • 原文地址:https://www.cnblogs.com/ceshi2016/p/6033313.html
Copyright © 2011-2022 走看看