Selenium + Java (10): teach you to modify the jar package, to achieve diagramming test reports and optimization

Today, when running the Automation code suddenly found test report pie chart disappeared, the investigation found that last for a long time is because quoted http://www.ichartjs.com/ichart.latest.min.js bounced off the site, inside ichart open source component failure, and seemingly has recently been unmaintained, open the URL so long following figure: Here Insert Picture Description
after the report but not this pie will become a giant automated reporting feeling ugly bare
(you can look at their search on the internet is not ReportNG report pie chart to see the way) about this:
Here Insert Picture Description
so I wrote this little tutorial, to achieve local rely js, test report diagramming. Procedure and works as follows:

  1. First, if there is no operation had reportNG configuration, you can see my blog post to learn: to teach you to configure ReportNG, landscaping automated test report .

  2. Download this package: iChart drawing components , and in our automated test report output path to create a js folder , inside this package will extract the files and placed under the js folder and file structure as shown:
    Here Insert Picture Description
    the extracted files placed just created js folder:
    Here Insert Picture Description

  3. According to my blog teach you to configure ReportNG, landscaping automated test report after the contents of the operation, we should download this pack: ReportNG dependent package download .

  4. The reportng-1.1.5.jar file decompression, after extracting open like this:Here Insert Picture Description

  5. We turn into the \ org \ uncommons \ reportng \ templates \ html, you can see the following files:

  6. We right-click on overview.html.vm, choose to use notepad editor:
    Here Insert Picture Description

  7. After opening, the first line of code 13 removed and replaced with the following code:

  <script src='./js/ichart.1.2.1.min.js'></script>
  <script src='./js/ichart.1.2.1.src.js'></script>

Here Insert Picture Description
Save.

  1. Ctrl + C will modify the good overview.html.vm file copy down, and then double-click to open our downloaded reportng-1.1.5.jar package, turn into the "\ org \ uncommons \ reportng \ templates \ html", then Ctrl + V , will be one of overview.html.vm replace the swap file, save the changes. Completed.
  2. In this way in the future we'll run the code, you can always successfully demonstrated a pie chart, rather than rely on remote jar package.
    Now, after running the code, so long report:
    Here Insert Picture Description
  3. If that is not beautiful. 2D pie chart, you can overview.html.vm type 242 in the second row to the files 3, and replaced into reportng-1.1.5.jar package to, individuals will feel nice some.
    Here Insert Picture Description
    3D demo below:
    Here Insert Picture Description

Ps: Of course, if your front-end code capability enough, you can change it to a rounded gradient color pie chart will look better. Just modify \ org \ uncommons \ reportng \ templates \ html in the file, you can change the style template corresponding template.
Finally, if the reference uncertain security jar package, then try to treat it downloaded for local use , or may be people inject malicious code when calling an external jar package.

软件测试工程师一只,也在不断的学习阶段,平时的小经验不定期分享。
博主经验有限,若有不足,欢迎交流,共同改进~
愿与同在CSDN的你共同进步。

Guess you like

Origin blog.csdn.net/qq_36396763/article/details/93062450