jenkins continuous integration of mail configuration

 

A disposed jar package
https://pan.baidu.com/s/1e6su8eOYy5GXKxvpet4uxw
the jar package placed E: \ apache-ant-1.9.13 \ lib (activation.jar, mail.jar)
Note: own local path ant

Second, modify Build
the build.xml file as follows, copy a go, we need to modify the relevant address

<?xml version="1.0" encoding="UTF-8"?>

<. "" Project name = "Ant-JMeter-Test" default = "RUN" = the basedir>
<the tstamp>
<Property the format = "Time" pattern = "yyyyMMddhhmm" />
</ the tstamp>
<-! need to change jmeter own local directory ->
<Property name = "jmeter.home" value = "F: \-jmeter the Apache-3.0" />
! <- who sent ->
<Property name = "mail_to" value = "[email protected]" />
<-! cc to whom, a plurality of separated by commas / ->
<-! Property name = "mail_cc" value = "@. 1 163 ++++ .com, [email protected] ++++ "/ ->
<Property name =" report.title "value =" Interface test report "/>
<-! JMeter generating path reported results jtl format - >
<Property name = "jmeter.result.jtl.dir"= value "F.: \ Apache-JMeter-3.0 \ Demo \ Report \ JTL" />
<- JMeter result report generation path of html format ->!
<property name="jmeter.result.html.dir" value="F:\apache-jmeter-3.0\demo\report\html" />
<!-- 生成的报告的前缀-->
<property name="ReportName" value="TestReport" />
<property name="jmeter.result.jtlName" value="${jmeter.result.jtl.dir}/${ReportName}${time}.jtl" />
<property name="jmeter.result.htmlName" value="${jmeter.result.html.dir}/${ReportName}${time}.html" />

<!--定义次build.xml要执行全部的任务-->
<target name="run">
<antcall target="test" />
<antcall target="report" />
<antcall target="mail" />
</target>

<!--第一个任务,执行test-->
<target name="test">
<taskdef name="jmeter" classname="org.programmerplanet.ant.taskdefs.jmeter.JMeterTask" />
<jmeter jmeterhome = "$ {} jmeter.home" resultlog = "$ {jmeter.result.jtlName}">
<-! script statements to run. "* .jmx" refers jmeter contains all the scripts in this directory ->
<testplans dir = "F: \-jmeter the Apache-3.0 \ Demo" Includes =. "* JMX" />
<Property name = "jmeter.save .saveservice.output_format "value =" XML "/>
</ JMeter>
</ target>

<-! redistribute jar package ->
<path ID =" xslt.classpath ">
<fileset the dir =" $ {JMeter. } Home / lib "Includes =" Xalan * .jar "/>
<fileset the dir =" $ {jmeter.home} / lib "Includes =" Serializer * .jar "/>
</ path>

<-! performing a second tasks, generate reports ->
<target name = "report">
<



= in "$ {} jmeter.result.jtlName"
OUT = "$ {} jmeter.result.htmlName"
style = "$ {} /extras/jmeter-results-detail-report_21.xsl jmeter.home">
<param name = "dateReport" = expression the "$ {report.datestamp}" />
</ XSLT>
<-! when generated as reported above, the associated picture will not be copied to the target directory together, therefore, need to manually copy - ->
<Copy todir = "$ {} jmeter.result.html.dir">
<fileset the dir = "$ {} jmeter.home / Extras">
<name = the include "collapse.png" />
<name = the include " expand.png "/>
</ fileset>
</ Copy>
</ target>

<-! output console to the text ->
<Record name =" $ {jmeter.result.html.dir} / {$ ReportName} $ {time} .txt " loglevel ="info" append="no" action="start"/>

<! - perform the third task, send e-mail ->
<target name = "mail">
<! - console log file read and write to the output of the message body ->
<LoadFile Property = "email_content" = srcFile "$ {jmeter.result.html.dir} / {the ReportName $ $}} {Time .txt" encoding = "UTF-. 8" />
<LoadFile Property = "Output" srcFile = "{$ jmeter.result. } html.dir / the ReportName $ {$}} {Time .html "encoding =" UTF-. 8 "/>
<-! here configured the SMTP server transmits the authorization code POP3 email address port to send mail relating ->
<mail ToList = "$ {} mail_to" the mailhost = "smtp.163.com" mailPort = "25"
User = "[email protected]" password = "Z11321281" Subject = "JMeter test report $ {ReportName} $ {time} "

messagemimetype="text/html">
<from address="[email protected]" />

<fileset dir="${jmeter.result.html.dir}">

<include name="${ReportName}${time}.html"/>

</ fileset>
<Message>
This is a test report is automatically transmitted by the Ant
$ {$ the ReportName} {Time}
$ {Output}
</ Message>
</ mail>
</ target>
</ Project>

 

You need to modify the position

Three, jenkins building, view mailbox messages, attachments that is automatically generated report

 

Guess you like

Origin www.cnblogs.com/malinalian/p/11386754.html