Contents: Guide
-
- foreword
- 1. From entry to mastery of Python programming
- 2. Interface automation project actual combat
- 3. Actual Combat of Web Automation Project
- 4. Actual Combat of App Automation Project
- 5. Resume of first-tier manufacturers
- 6. Test and develop DevOps system
- 7. Commonly used automated testing tools
- Eight, JMeter performance test
- 9. Summary (little surprise at the end)
foreword
1. Download, install and configure Jmeter
First download the jmeter tool and configure the environment variables;
refer to the article written before: https://blog.csdn.net/shuang_waiwai/article/details/121641310
By default, jmeter saves files in .jtl format. To set bin/jmeter.properties, file content, save jmeter.save.saveservice.output_format=xml
2. Download, install and configure ant
Download the ant tool and configure the environment variables;
download it directly from the official website: https://ant.apache.org/bindownload.cgi
3. Trigger the configuration of the jmeter script through ant
Copy the ant-JMeter-1.1.1.jar in the extras subdirectory under the directory where JMeter is located to the lib subdirectory under the directory where Ant is located, so that "org.programmerplanet.ant.taskdefs.jmeter.JMeterTask" can be found when Ant is running class, thus successfully triggering the JMeter script.
Under the extras folder in jmeter; as shown below:
Under the lib file of the ant toolkit
4. Automatically send email jar package configuration
As shown below:
1. Download the commons-email.jar package on the website, and then put it in the \lib directory of ant;
address: https://commons.apache.org/proper/commons-email/download_email.cgi
2. Download the activation-1.1.1.jar package on the website, and put it in the \lib directory of ant;
address: http://www.java2s.com/Code/Jar/a/Downloadactivation111jar.htm
3. Download the javax.mail.jar package from the website, and put it in the \lib directory of ant;
address: https://javaee.github.io/javamail/
5. Create the following directory structure
resultlog:
html =>ant converted result.
The result generated by jtl=>imeter
script:
the script executed by jmeter
Configure the build.xml file:
source code:
<?xml version="1.0" encoding="UTF-8"?>
<project name="ant-jmeter-test" default="run" basedir=".">
<tstamp>
<format property="time" pattern="yyyyMMddhhmm" />
</tstamp>
<property environment="env"/>
<property name="ReportName" value="TestReport" />
<!-- 需要改成自己本地的 Jmeter 目录-->
<property name="jmeter.home" value="D:\B_TOOLS\apache-jmeter-2.13" />
<!-- jmeter生成jtl、html格式的结果报告的路径-->
<property name="jmeter.result.dir" value="${env.WORKSPACE}/results/${env.BUILD_ID}" />
<!-- 生成的报告的前缀-->
<property name="jmeter.result.jtlName" value="${jmeter.result.dir}/${ReportName}.jtl" />
<property name="jmeter.result.htmlName" value="${jmeter.result.dir}/${ReportName}.html" />
<target name="run">
<echo message="start..."/>
<antcall target="clean" />
<antcall target="test" />
<antcall target="report" />
</target>
<target name="clean">
<mkdir dir="${env.WORKSPACE}/results/${env.BUILD_ID}" />
</target>
<target name="test">
<taskdef name="jmeter" classname="org.programmerplanet.ant.taskdefs.jmeter.JMeterTask" />
<jmeter jmeterhome="${jmeter.home}" resultlog="${jmeter.result.jtlName}">
<!-- 声明要运行的脚本"*.jmx"指包含此目录下的所有jmeter脚本-->
<testplans dir="D:\B_TOOLS\apache-jmeter-2.13\demo" includes="*.jmx" />
<property name="jmeter.save.saveservice.output_format" value="xml"/>
</jmeter>
</target>
<target name="report">
<xslt in="${jmeter.result.jtlName}"
out="${jmeter.result.htmlName}"
style="${
jmeter.home}/extras/jmeter-results-detail-report_21.xsl" />
<!-- 因为上面生成报告的时候,不会将相关的图片也一起拷贝至目标目录,所以,需要手动拷贝 -->
<copy todir="${jmeter.result.dir}">
<fileset dir="${jmeter.home}/extras">
<include name="collapse.png" />
<include name="expand.png" />
</fileset>
</copy>
</target>
</project>
The build.xml file should be placed in the pc or app directory; as shown below:
Configure the details of the build.xml file content
Key point: smtp authorization code; such as QQ mailbox
After the configuration is complete, open the DOS window and enter the directory where the build.xml file is located, and enter ant to generate a report and send it to the designated person's mailbox; the result is as shown in the figure below
6. Build through jenkins and automatically run the jmeter script
Create a new item task; as shown below
Build a trigger and set how often it triggers
Timed tasks:
Minutes: Hours: Days in January: Months: Days in a week
0-59: 0-23: 1-31: 1-12: 0-7 (0 and 7 represent weeks sky)
Example: 0 20 * * *
is automatically executed at 20:00 every night
Execute
0 20 * * 1, 3, 5 at 20 o'clock in the evening on the 1st, 3rd, and 5th of a week
Execute
0 20 * * 1-5 at 20:00 every week from Monday to Friday
Execute
0 20 * * */2 every 2 days in a week at 20 o'clock in the evening
Jump to the build step interface, click Add Build Step and select Invoke Ant
Then click the Advanced button
Copy the path of the build.xml file to the location shown below
Click Save to return to the main page; click Build Now to start execution
Execution results, check the recipient's mailbox
The following is the most complete software test engineer learning knowledge architecture system diagram in 2023 that I compiled |
1. From entry to mastery of Python programming
2. Interface automation project actual combat
3. Actual Combat of Web Automation Project
4. Actual Combat of App Automation Project
5. Resume of first-tier manufacturers
6. Test and develop DevOps system
7. Commonly used automated testing tools
Eight, JMeter performance test
9. Summary (little surprise at the end)
Facing challenges bravely and pursuing dreams firmly. With tireless efforts, talents will bloom; with continuous struggle, brilliance will eventually emerge. Believe in your unlimited potential, seize the opportunity, and create your own miracle.
No matter how thorny the road ahead is, ignite the fire of hope; no matter what difficulties we are in, we will bloom the strength to move forward bravely. Travel all over the mountains and rivers to pursue the ideals in your heart; raise your sails and sail towards the glory of the future. Believe in yourself, keep striving, and achieve a wonderful life with infinite possibilities!
Years go by, struggles are endless; embrace dreams and burn passion. Not afraid of difficulties, bravely climb the peak; watered with sweat, bloom brilliantly. Every effort is worthy of pride; every struggle is closer to success.