Jmeter HTML Report with notes extension (i)

Source: Internet
Author: User
Tags xml xpath xpath xsl xsl stylesheet

Preface: You can generate an HTML report when using LoadRunner, and it contains various charts and detailed data. It is not possible to generate Html reports directly after using the Jmeter test (whether it is started with a GUI or a command line).

After finding the data found in Jmeter's Extras directory, there is an XSL stylesheet that generates HTML, in fact, the HTML report generated by Jenkins+ant+jmeter is also called the stylesheet generated here, so

Xsltproc report.jtl > test.html, or Ant is also available. This command converts the JMeter result file into an HTML report. The results are as follows: Although the HTML report can be generated here, the report is too weak to be used and contains too few parameters. So the report needs to be expanded. Because the aggregated data of the Jmeter itself is still relatively full,

It is therefore intended to be extended according to the value of that report.

Xsltproc,xlst Introduction

XSL refers to the Extended Stylesheet Language (extensible Stylesheet Language), which transforms XML into HTML with a stylesheet written in xls, so if you want to extend this report, first

Familiar to change and extend the style sheet. You can learn this language here in http://www.w3school.com.cn/xsl/index.asp.

Xsltproc is a fast XSLT engine that transforms XML into a file of the appropriate format through an XSL cascading style sheet, such as: html,xhtml,pdf

For example, to convert XML to HTML, use the following format:

Xsltproc xsl-html.xsl Hoto.xml-o html.html (you can also directly write the stylesheet file to the href attribute of the Jtl file, visually tell the XML which style sheet to use)

XLS to find XML XPath, so also need to be familiar with XPath, xsltproc this engine is the xpath1.0 version, so using XPath in the style sheet is a function that cannot use xpath2.0 and some properties. I'm familiar with XPath, but I'm not familiar with XLS at all, and there's no way to learn xls and XPath directly in order to expand the report. (about XLS will write again the blog introduction, by the way, the use of problems and experience in the process of summarizing)

If the direct use of Ant and Jmeter integration can also be directly generated, but the ant conversion HTML engine is only supported xpath1.0, and later learned that most of the engines do not support xpath2.0, so the mid-term cannot use the xpath2.0 function.

90%line time in order to be able to show the time of 90%line, the first to be familiar with this indicator, this indicator is worth a set of data, in 90% of the location of the data time, so we expand as long as we know the 90% position index, then we can get this value. Here are some of the key codes

<xsl:variable name="allMedianTime">                  <xsl:call-template name="LineTime">                    <xsl:with-param name="nodes" select="/testResults/*/@t" /> <xsl:with-param name="position" select="ceiling($allCount * 0.9)" /> </xsl:call-template> </xsl:variable>

Here is mainly the collection of time elements, as well as the location of the 90%line, with these two parameters can be later extended, after the expansion of the following:

Because the 90%line and 95%line,99%line calculation principles are consistent, it is good to calculate the value of the other value as long as it is calculated

QPS extension

The Jmeter report has throughput this value, which is expressed as throughput in LoadRunner, which can be expressed as a QPS or TPS (in the case of transactions), which the individual calls a QPS, because it is more intuitive.

and%90line the same truth, we must first know how this value is calculated, after looking for data and official website comparison, found that this value is calculated by the following formula:

On the official website:

Throughput = (number of requests)/(total time)

Total time = Test Finish-Test start time

Test End time = MAX (Request start time + Elapsed time) test start = MIN (Request start time)

Knowing the formula, then the calculation is easy, the following is the key code:

<xsl:variable name="nodeThroughput">                  <xsl:call-template name="throughput">                    <xsl:with-param name="nodes" select="/testResults/*/@ts" /> <xsl:with-param name="count" select="$allCount" /> </xsl:call-template> </xsl:variable>

The results of the extension are as follows:

Throughput expansion

The throughput in LoadRunner is throughput, the last column in the Jmeter aggregation report is throughput in LoadRunner, and for the sake of distinction, I call this value throughput,

i.e. throughput.

After finding the data, the calculation of throughput is the same as that of the QPS, because it is the following formula:

Throughput = (total number of bytes requested)

The total time calculation here is the same as that of the QPS, which adds up all the requests directly, and the key code is as follows:

<xsl:variable name="nodeKB">                  <xsl:call-template name="throughput">                    <xsl:with-param name="nodes" select="/testResults/*/@ts" /> <xsl:with-param name="count" select="sum(/testResults/*/@by) div 1024" /> </xsl:call-template> </xsl:variable>

Because the bytes shown here, the final result I intend to display in KB units, so here we need to divide by 1024, the result of the extension is as follows

TPS Extension

TPS in Jmeter Although some conditions are consistent with the QPS, there are inconsistencies, so there is also a need to expand, and the results look clearer.

First, as with other parameter extensions, you need to know the calculation formula, here the formula and the QPS is the same, but the data collection is not the same, the following is the effect of the extension. In the extended process, it is further discovered that the last "overall" line of the Jmeter aggregation results in some cases the calculated value is inaccurate. If the script does not contain transactions, then the results here are accurate, if all contain transactions and the

Generate when the parent sample is selected, the result is accurate, there is a transaction in the script and the Generate parent sample is not selected, or some of the transactions are not, the result is inaccurate because the view calculation

Way to find out that it has counted all the requests.

For example, an JTL file contains an HTTP request that also contains a transaction, because the transaction is only a statistic of the previous request, which itself does not send the request, so it is not possible to calculate the total throughput, Qps,tps.

So in the process of expansion is divided into two stylesheets, a style sheet processing contains transactions, or no transactions, the results are measured in QPS, a stylesheet processing is all a matter of the case, the results are measured in TPS, so

is accurate.

Test

Several indicators have been expanded, and what are the correctness of these indicators? Testing is required in a variety of situations, and the indicators are correct after testing. However, it has not been tested at a large data volume level, and if there are any problems after testing, it will be timely

Change.

Remember: Because the stylesheet is based on the request of LB, so the lable here can not be repeated, itself should not be repeated, including Jmeter aggregation reports are lable to distinguish

PS: The difficulty in the expansion process is how the formula is calculated, the second is the XLS this refers to the extended Stylesheet language is not very familiar, and itself has a lot of restrictions, will be described in the next blog. But after the feeling is still very good familiar with the XPath is also familiar with the XLS.

Three is need to Jmeter test results file each field wearing table what meaning familiar, so as to customize more indicators, this will also be in a separate blog to explain

OneAPM Mobile Insight provides a real user experience as a metric for crash analysis, monitoring network requests and network errors, and improving user retention. Visit the official website of ONEAPM for more application performance optimization experiences and to read more technical articles, visit the ONEAPM Official technology blog.

Jmeter HTML Report with notes extension (i)

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.