1.主任务执行压测任务设置
cd /usr/apache-jmeter-5.1.1.linux/bin
rm -rf report /var/lib/jenkins/workspace/ttlStressTest/html_report
cat /dev/null > users_details.txt
cat /dev/null > users_order_search.txt
./jmeter -n -t ttlStressTest.jmx -l report/stress.log -j report/stress.jtl -e -o /var/lib/jenkins/workspace/ttlStressTest/html_report
touch /var/lib/jenkins/workspace/ttlStressTest/html_report/index2.html
2.次任务生成报告及封装报告迭代走势内容
cd /usr/apache-jmeter-5.1.1.linux/bin/make_stress_chart
/usr/local/bin/python3 Test.py
邮件发送内容:
<!DOCTYPE html> <html> <head> <meta charset="UTF-8"> <title>${ENV, var="JOB_NAME"}-第${BUILD_NUMBER}次构建日志</title> </head> <body leftmargin="8" marginwidth="0" topmargin="8" marginheight="4" offset="0"> <table width="95%" cellpadding="0" cellspacing="0" style="font-size: 11pt; font-family: Tahoma, Arial, Helvetica, sans-serif"> <tr> <td><br /> <b><font color="#0B610B">构建结果</font></b> <hr size="2" width="100%" align="center" /></td> </tr> <tr> <td> <div>${BUILD_STATUS}</div> </td> </tr> <tr> <td><br /> <b><font color="#0B610B">构建信息</font></b> <hr size="2" width="100%" align="center" /></td> </tr> <tr> <td> <ul> <li><b>项目名称</b> : ${PROJECT_NAME}</li> <li><b>构建编号</b> : 第${BUILD_NUMBER}次构建</li> <li><b>触发原因</b> : ${CAUSE}</li> <li><b>构建状态</b> : ${BUILD_STATUS}</li> <li><b>工作目录</b> : <a href="http://192.168.99.125:8080/job/ttlStressTest/ws">http://192.168.99.125:8080/job/ttlStressTest/ws</a></li> <li><b>项目地址</b> : <a href="http://192.168.99.125:8080/job/ttlStressTest/">http://192.168.99.125:8080/job/ttlStressTest/</a></li> <li><b>测试报告</b> : <a href="http://192.168.99.125:8080/job/ttlStressTest/HTML_20Report">http://192.168.99.125:8080/job/ttlStressTest/HTML_20Report</a></li> </ul> </td> </tr> <tr> <td> <div>${FILE ,path="/var/lib/jenkins/jobs/ttlStressTest/htmlreports/HTML_20Report/index_email.html"}</div> </td> </tr> </table> </body> </html>