jenkins learning 9- test report mail (Email Extension Plugin)

Foreword

As already demonstrated in the realization of the test report html jenkins, followed by thin final step, the reports sent to your leadership, to show the fruits of your labor.

Email Extension Plugin installed plug-ins

jenkins Home - System Management - plug-in management, optional plug-ins, search: Email, Email Extension Plugin installed plug-ins

Test your mailbox

jenkins Home - System Management - System Configuration page, configure the system piping member of the e-mail address, which is the sender's address

Whether or not the test mailbox configuration can send e-mail

  • SMTP server server address, a different mailbox here is not the same
  • The user name your own email address, consistent with the above system administrator e-mail address
  • QQ-mail password SMTP_SSL mode is used, so there is not a QQ password is an authorization code
  • QQ-mail using the SSL protocol to be checked, Tencent do not need to check E-mail
  • General default smtp port 465
  • Test Test e-mail recipient address of the recipient

Point to the right of the Test configurationbutton test test message

Extended E-mail Notification Configuration

Previous jenkins system comes with a mail function, function is relatively small, then use Email Extension Plugin plug-in, with the previous configuration step above almost

Type Default Content Type mail using HTML format
Default Recipients is the default recipient

Then premium content to configure the mail template content, that is, the mail Email

  • Theme Default Subject mail, generally do not change
  • Default Content body content of the message, html format, which reads as follows
<!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>    
            本邮件由系统自动发出,无需回复!<br/>            
            各位同事,大家好,以下为${PROJECT_NAME }项目构建信息</br> 
            <td><font color="#CC0000">构建结果 - ${BUILD_STATUS}</font></td>   
        </tr>    
        <tr>    
            <td><br />    
            <b><font color="#0B610B">构建信息</font></b>    
            <hr size="2" width="100%" align="center" /></td>    
        </tr>    
        <tr>    
            <td>    
                <ul>    
                    <li>项目名称 : ${PROJECT_NAME}</li>    
                    <li>构建编号 : 第${BUILD_NUMBER}次构建</li>    
                    <li>触发原因: ${CAUSE}</li>    
                    <li>构建状态: ${BUILD_STATUS}</li>    
                    <li>构建日志: <a href="${BUILD_URL}console">${BUILD_URL}console</a></li>    
                    <li>构建  Url : <a href="${BUILD_URL}">${BUILD_URL}</a></li>    
                    <li>测试报告: <a href="${PROJECT_URL}allure">${PROJECT_URL}allure</a></li>    
                </ul>    

<h4><font color="#0B610B">失败用例</font></h4>
<hr size="2" width="100%" />
$FAILED_TESTS<br/>

<h4><font color="#0B610B">最近提交(#$SVN_REVISION)</font></h4>
<hr size="2" width="100%" />
<ul>
${CHANGES_SINCE_LAST_SUCCESS, reverse=true, format="%c", changesFormat="<li>%d [%a] %m</li>"}
</ul>
详细提交: <a href="${PROJECT_URL}changes">${PROJECT_URL}changes</a><br/>

            </td>    
        </tr>    
    </table>    
</body>    
</html>

Configure trigger job

Open the message we need to send the job, which added to the configuration of the building after the operation

Then add the trigger mechanism: always be constructed regardless of success or failure will send e-mail

You can configure the trigger inside the current job specified recipients can also add a log to check the mailbox

received e-mail

Check the contents of the message received by mail

构建结果 - Successful

构建信息
项目名称 : pytest_demo
构建编号 : 第28次构建
触发原因: Started by user admin
构建状态: Successful
构建日志: http://49.235.92.12:9090/job/pytest_demo/28/console
构建 Url : http://49.235.92.12:9090/job/pytest_demo/28/
测试报告: http://49.235.92.12:9090/job/pytest_demo/allure

点开链接可以直接查看job详情和信息的测试报告

Guess you like

Origin www.cnblogs.com/yoyoketang/p/12174056.html