美文网首页
jenkins robotfromework插件及邮件发送

jenkins robotfromework插件及邮件发送

作者: 清水秋香 | 来源:发表于2020-04-30 18:07 被阅读0次

安装 Robot Framework plugin 插件

image.png image.png

选择 Publish Robot Framework test results插件

image.png
Directory of Robot output 填写生成报告的路径
Thresholds for build result 含义:不稳定用例和稳定用例的临界值,但是由于我们不期望有不稳定的用例仍然认为结果是准确的,所以这里都设置为100%

示例:两个都填写100.0%


image.png

发送邮件配置
首先这里一定要进行配置,否则发送邮件会失败

image.png image.png

点击构建后操作步骤
选择 Editable Email Notification

image.png

填写发送邮件的邮箱,以逗号分割

image.png
triggers
配置邮件触发命令,默认失败后触发
我们配置成每次构建都会发送选择always
多条件可继续添加add trigger
image.png

配置邮件模版

image.png
<!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>本邮件是程序自动下发,请勿回复!</td>
</tr>
<tr>
   <td><h2><font color="#0000FF">构建结果 - ${BUILD_STATUS}</font></h2></td>
</tr>
<tr>
   <td><br /> <b><font color="#0B610B">构建信息</font></b> <hr size="2" width="100%" align="center" /></td> 
</tr> 
<tr>
<td> 
     <ul> 
          <li>项目名称&nbsp;:&nbsp;${PROJECT_NAME}</li>
          <li>构建编号&nbsp;:&nbsp;第${BUILD_NUMBER}次构建</li>
          <li>触发原因:&nbsp;${CAUSE}</li>
          <li>构建日志:&nbsp;<a href="${BUILD_URL}console">${BUILD_URL}console</a></li>
          <li>构建&nbsp;&nbsp;Url&nbsp;:&nbsp;<a href="${BUILD_URL}">${BUILD_URL}</a></li>
          <li>工作目录&nbsp;:&nbsp;<a href="${PROJECT_URL}ws">${PROJECT_URL}ws</a></li>
          <li>项目&nbsp;&nbsp;Url&nbsp;:&nbsp;<a href="${PROJECT_URL}">${PROJECT_URL}</a></li>
     </ul> 
</td> 
</tr>
<tr>
     <td>
          <b><font color="#0B610B">Changes Since Last Successful Build:</font></b>
          <hr size="2" width="100%" align="center" />
     </td> 
</tr> 
<tr> 
     <td>
         <ul> 
              <li>历史变更记录 : <a href="${PROJECT_URL}changes">${PROJECT_URL}changes</a></li>
         </ul></td> 
</tr>
<tr>
     <td>
          <b>Failed Test Results</b> <hr size="2" width="100%" align="center" />
     </td> 
</tr>
<tr>
     <td>
          <pre style="font-size: 11pt; font-family: Tahoma, Arial, Helvetica, sans-serif">$FAILED_TESTS</pre> <br />
     </td>
</tr>
<tr>
     <td><b><font color="#0B610B">构建日志 (最后 100行):</font></b> <hr size="2" width="100%" align="center" /></td>
</tr> <!-- <tr> <td>Test Logs (if test has ran): <a href="${PROJECT_URL}ws/TestResult/archive_logs/Log-Build-${BUILD_NUMBER}.zip">${PROJECT_URL}/ws/TestResult/archive_logs/Log-Build-${BUILD_NUMBER}.zip</a> <br /> <br /> </td> </tr> --> 
<tr>
<td>
     <textarea cols="80" rows="30" readonly="readonly" style="font-family: Courier New">${BUILD_LOG, maxLines=100}</textarea> 
</td> 
</tr>
</table>
</body>
</html>

发送附件
这里填入的是相对与工作区的相对路径

image.png

相关文章

网友评论

      本文标题:jenkins robotfromework插件及邮件发送

      本文链接:https://www.haomeiwen.com/subject/nqzawhtx.html