It is not possible to generate HTML reports directly after the JMeter test, but instead to JTL reports. Here we can use Xsltproc to solve.
Xsltproc is a fast XSLT engine written by Danielveillard for the C language,
It can convert XML to a file of the appropriate format through an XSL cascading style sheet.
For example: Html,xhtml,pdf ...
XSL refers to the extended style sheet language (extensible Stylesheet Language),
converting XML to HTML is a style sheet written in xls,
So if you want to extend this report, first be familiar with XLS,
To change and extend the style sheet.
You can learn this language here in http://www.w3school.com.cn/xsl/index.asp.
Idea+jmeter Test Environment Construction
- Modifying the Jmeter.properties configuration file
Jmeter.save.saveservice.output_format=xml
- Download the Xsltproc file and unzip it and add the executable path to the environment variable.
Download path: Link: https:pan.baidu.com/s/1qzpolwo Password: ky88
refer to this article: http:www.crifan.com/files/doc/docbook/docbook_dev_note/release/webhelp/download_xsltproc_win.html
- To copy a report template file
The JMeter installation directory \extras under Jmeter-results-detail-report_21.xsl and
Copy the jmeter-results-report_21.xsl template file to
Src\test\resources folder, under the JMeter folder, place the. jmx file,
If the report cannot be expanded, copy collapse.png and expand.png to the resources folder
- Modify the Pom file
<plugin> <groupId>com.lazerycode.jmeter</groupId> <artifactId> jmeter-maven-plugin</artifactid> <version>2.1.0</version> <ignoreresultfailures >true</ignoreResultFailures> <testResultsTimestamp>false</ testresultstimestamp> <testFilesIncluded> <jmetertestfile>testdemo.jmx</ jmetertestfile> </testFilesIncluded> <executions> <execution> <id >jmeter-tests</id> <phase>verify</phase> <goals> <goal>jmeter </goal> </goals> </execution> </executions></plugin>
- Execute verify, and then enter the following code in the command line to output the HTML report
Xsltproc-o target/jmeter/results/testdemo.html src/test/resources/jmeter-results-detail-report_21.xsl target/ Jmeter/results/testdemo.jtl
- View Reports
Next is to integrate with Jenkins, do continuous integration testing, will be in the next article detailed introduction, please look forward to!
Convert JTL reports to HTML reports using Xsltproc