python + git + jenkins step on the pit [BSTestRunner module cannot be loaded, the starting path cannot be found, the file cannot be read]

First, the local pycharm of Windows, put BSTestRunner under lib, it can run normally, and put it into the linux environment, the error is shown in the figure:

 

 

 

Solution: Put BSTestRunner directly into the project, when importing, directly add the path to import, eg:

 

 

 Second, during deployment, it prompts that the starting path cannot be found, and a bunch of errors are shown in the figure:

 

 

 Solution: Write the path of test_case and report address as an absolute path, eg:

 

 3. Add html link to the report: system management-system configuration-template configuration as shown below:

<!DOCTYPE html>    

<html>    

<head>    

<meta charset="UTF-8">    

<title> $ {ENV, var = "JOB_NAME"}-the $ {BUILD_NUMBER} build log </ 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>    

            This email is automatically sent by the system without reply! <br/>            

            Dear colleagues, everyone, the following is the construction information of the $ {PROJECT_NAME} project </br> 

            <td><font color="#CC0000">构建结果 - ${BUILD_STATUS}</font></td>   

        </tr>    

        <tr>    

            <td><br />    

            <b> <font color = "# 0B610B"> Build information </ font> </ b>    

            <hr size="2" width="100%" align="center" /></td>    

        </tr>    

        <tr>    

            <td>    

                <ul>    

                    <li> Project name: $ {PROJECT_NAME} </ li>    

                    <li> Build number: $ {BUILD_NUMBER} build # </ li>    

                    <li> Trigger reason: $ {CAUSE} </ li>    

                    <li> Build status: $ {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}ws">${PROJECT_URL}ws</a></li>    

                    <li>项目  Url : <a href="${PROJECT_URL}">${PROJECT_URL}</a></li>    

                    <li>报告  Url : <a href="${PROJECT_URL}HTML_20Report">${PROJECT_URL}HTML_20Report</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>    

<tr>

<td>

<div>${FILE ,path="/var/lib/jenkins/jobs"}</div>

</td>

</tr>

 

    </table>    

</body>    

 

</html>

 

 After the deployment is successful, the email content is as follows:

 

 When opening the link, you need to log in to jenkins

4. HTML reports that the style is messed up when jenkins is opened

Solution: 1. Download the Groovy plugin

 

2. New build action:

 

 System.setProperty("hudson.model.DirectoryBrowserSupport.CSP", "")

 

 

 

 

 

Guess you like

Origin www.cnblogs.com/cherry20180320/p/12740968.html