hello!python!

jenkins 发送testng测试结果

jenkins  发送testng测试结果:

1、构建后操作添加 publish testng results,没有的可以先去安装插件

 

 2、邮箱内容配置如下

<!DOCTYPE html>
<html>
    <head>
        <meta charset="UTF-8">
            <title>${PROJECT_NAME}-第${BUILD_NUMBER}次构建日志</title>
        </head>

        <body leftmargin="8" marginwidth="0" topmargin="2" marginheight="4"
      offset="0">
            <table width="95%" cellpadding="0" cellspacing="0"
       style="font-size: 11pt; font-family: Tahoma, Arial, Helvetica, sans-serif">

                <tr>
                    <td>
                        <h2>
                            <font color="#0000FF">构建结果 - ${BUILD_STATUS}</font>
                            <br>
                                <font size="2">(本邮件是程序自动下发的,请勿回复!)</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>项目名称 : ${PROJECT_NAME}</li>
                                <li>构建编号 : 第${BUILD_NUMBER}次构建</li>
                                <li>触发原因: ${CAUSE}</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}ws">${PROJECT_URL}ws</a>
                                </li>
                                <li>项目  Url : <a href="${PROJECT_URL}">${PROJECT_URL}</a>
                                </li>
                            </ul>
                            <br />
                        </td>
                    </tr>

                    <tr>
                        <td>
                            <b>
                                <font color="red">Test Informations</font>
                            </b>
                            <hr size="2" width="100%" align="center" />
                        </td>
                    </tr>

                    <div align="left">
                        <table border="2" cellspacing="0" width="400">
                            <tr>
                                <th width="200px">
                                    <font size="3">Total</font>
                                </th>
                                <th width="200px">
                                    <font size="3">Pass</font>
                                </th>
                                <th width="200px">
                                    <font size="3">Failed</font>
                                </th>
                                <th width="200px">
                                    <font size="3">Skiped</font>
                                </th>
                            </tr>
                            <tr onmouseover="this.style.backgroundColor='#ffff66';" onmouseout="this.style.backgroundColor='#d4e3e5';">
                                <td align="center">
                                    <font size="3">${TEST_COUNTS,var="total"}</font>
                                </td>
                                <td align="center">
                                    <font size="3">${TEST_COUNTS,var="pass"}</font>
                                </td>
                                <td align="center">
                                    <font color="red" size="3">
                                        <b>${TEST_COUNTS,var="fail"}</b>
                                    </font>
                                </td>
                                <td align="center">
                                    <font size="3">${TEST_COUNTS,var="skip"}</font>
                                </td>

                            </tr>
                        </table>
                    </div>
                    <br />
                    <tr>
                        <td>
                            <br />
                            <b>
                                <font color="red" size="2"> 详细内容见测试报告:</font>
                            </b>
                            <a href="${BUILD_URL}allure">${BUILD_URL}allure</a>
                        </td>
                    </tr>
                </table>
            </body>
        </html>

 

posted @ 2022-12-05 12:06  你坚持了吗  阅读(181)  评论(0编辑  收藏  举报
hello!python!