<ruby id="bdb3f"></ruby>

    <p id="bdb3f"><cite id="bdb3f"></cite></p>

      <p id="bdb3f"><cite id="bdb3f"><th id="bdb3f"></th></cite></p><p id="bdb3f"></p>
        <p id="bdb3f"><cite id="bdb3f"></cite></p>

          <pre id="bdb3f"></pre>
          <pre id="bdb3f"><del id="bdb3f"><thead id="bdb3f"></thead></del></pre>

          <ruby id="bdb3f"><mark id="bdb3f"></mark></ruby><ruby id="bdb3f"></ruby>
          <pre id="bdb3f"><pre id="bdb3f"><mark id="bdb3f"></mark></pre></pre><output id="bdb3f"></output><p id="bdb3f"></p><p id="bdb3f"></p>

          <pre id="bdb3f"><del id="bdb3f"><progress id="bdb3f"></progress></del></pre>

                <ruby id="bdb3f"></ruby>

                合規國際互聯網加速 OSASE為企業客戶提供高速穩定SD-WAN國際加速解決方案。 廣告
                # 10D 高級 WebDriver – JUnit 報告自定義續 > 原文: [https://javabeginnerstutorial.com/selenium/10d-advanced-webdriver-junit-report-customization-part2/](https://javabeginnerstutorial.com/selenium/10d-advanced-webdriver-junit-report-customization-part2/) 嗨冠軍! 如果您沒有讓[之前的文章](https://javabeginnerstutorial.com/selenium/10c-advanced-webdriver-junit-report-customization/)發揮您的想象力,那么我今天將幫助您做到這一點。 我們將成為, * 添加或刪除列 * 改變風格 * 在標題部分添加徽標 * 修改靜態文字 ## 添加或刪除列 這真是小菜一碟。 添加或刪除`<th>`和`<td>`標簽可實現此任務。 讓我們來看一個場景,在“`All Tests`”表中,添加`Executed By`列。 ```java <!-- method header --> <xsl:template name="testcase.test.header"> <xsl:param name="show.class" select="''"/> <tr valign="top"> <xsl:if test="boolean($show.class)"> <th>Class</th> </xsl:if> <th>Name</th> <th>Status</th> <th width="60%">Type</th> <th nowrap="nowrap">Time(s)</th> <th>Executed By</th> </tr> </xsl:template> ``` 在此模板下,`<xsl:template match="testcase" mode="print.test">` 連同現有的欄一起為新創建的“執行者”欄添加一個值。 ```java <td> <xsl:call-template name="display-time"> <xsl:with-param name="value" select="@time"/> </xsl:call-template> </td> <td>Tester1</td> </tr> </xsl:template> ``` ### 之前 ![Before adding column](https://img.kancloud.cn/aa/4d/aa4d3dff0cf7f79160cbdd4dfc1d7616_703x219.png) ### 之后 ![After adding a column](https://img.kancloud.cn/11/6a/116aecbfb59d81639bb3694de9fca678_776x226.png) ## 改變風格 努力思考如何更改生成的報告中的樣式? 無需為此費心! 因為和其他網頁一樣,我們也有一個 CSS 樣式表來處理此報告的樣式。 只需在“`junit-frames.xsl`”文件中搜索名稱為“`stylesheet.css`”的模板即可。 ```xml <!-- this is the stylesheet css to use for nearly everything --> <xsl:template name="stylesheet.css"> ``` 主體,表,標題,棧跟蹤,錯誤,失敗,段落,屬性的樣式均在此模板中指定。 繼續前進,戴上帽子! 對 CSS 的每一行進行試驗,并查看呈現的更改。 是的,您也可以添加自己的 CSS! 讓我們來看一個入門的小示例。 表的詳細信息和失敗樣式如下所示, ```css table.details tr th{ font-weight: bold; text-align:left; background:#a6caf0; } .Failure { font-weight:bold; color:purple; } ``` 讓我們將這些更改如下: 1. 所有表格標題均居中對齊 2. 表格標題行的背景顏色為“綠色黃色”(`#ADFF2F`) 3. 失敗文字顏色變為栗色 ```css table.details tr th{ font-weight: bold; text-align:center; background:#ADFF2F; } .Failure { font-weight:bold; color:maroon; } ``` ### 之前 ![Before changing styles](https://img.kancloud.cn/12/6f/126f31dff32a0bc76e9616874f1d78ab_1095x458.png) ### 之后 ![After changing the styles](https://img.kancloud.cn/bb/2d/bb2d006310145906a33fbad96d38a0de_1058x437.png) 我知道,它看起來并不吸引眼球,但我們證明了我們想要的。 所以,你去了! ## 在標頭部分中添加徽標 我們大多數人都喜歡生成的報告上的徽標。 誰不喜歡個性化和一點營銷? 如果您懂一點 HTML,就非常簡單。 在名為“`pageHeader`”的模板上,添加一個圖像標簽,并在`src`屬性中指定路徑。 我已將徽標圖像放置在生成`index.html`文件的項目的“`junit`”文件夾中。 ```xml <xsl:template name="pageHeader"> <!-- <h1><xsl:value-of select="$TITLE"/></h1> --> <h1>Custom JUnit Report</h1> <table width="100%"> <tr> <td align="left"></td> <td align="right"><img width="50" height="50" alt="Selenium" src="myLogo.jpg"/> Designed by ninjas!</td> </tr> </table> <hr size="1"/> </xsl:template> ``` ### 結果 ![Adding a Logo](https://img.kancloud.cn/aa/5a/aa5ab5931b45ff76444c2de6e105a5db_1089x208.png) **修改靜態文本** 這是錦上添花(哦!您現在已經知道了)。 要修改報告中顯示的任何靜態文本,您只需在“`junit-frames.xsl`”文件中進行更改。 是的,你沒看錯。 就這么簡單! 假設在報告的摘要表中,而不是“測試”,我希望它是“測試數量”。 只需在`h2`標簽上顯示“摘要”的正文部分更改文本, ```xml <table class="details" border="0" cellpadding="5" cellspacing="2" width="95%"> <tr valign="top"> <th>Number of Tests</th> <th>Failures</th> <th>Errors</th> <th>Skipped</th> <th>Success rate</th> <th>Time</th> </tr> ``` ### 結果 ![Modifying static text](https://img.kancloud.cn/0a/fa/0afa3c5993605465f023706eac01f8e1_1028x243.png) 是時候對我們到目前為止所學到的東西進行反思。 在另一篇文章中再見。 自定義愉快!
                  <ruby id="bdb3f"></ruby>

                  <p id="bdb3f"><cite id="bdb3f"></cite></p>

                    <p id="bdb3f"><cite id="bdb3f"><th id="bdb3f"></th></cite></p><p id="bdb3f"></p>
                      <p id="bdb3f"><cite id="bdb3f"></cite></p>

                        <pre id="bdb3f"></pre>
                        <pre id="bdb3f"><del id="bdb3f"><thead id="bdb3f"></thead></del></pre>

                        <ruby id="bdb3f"><mark id="bdb3f"></mark></ruby><ruby id="bdb3f"></ruby>
                        <pre id="bdb3f"><pre id="bdb3f"><mark id="bdb3f"></mark></pre></pre><output id="bdb3f"></output><p id="bdb3f"></p><p id="bdb3f"></p>

                        <pre id="bdb3f"><del id="bdb3f"><progress id="bdb3f"></progress></del></pre>

                              <ruby id="bdb3f"></ruby>

                              哎呀哎呀视频在线观看