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:
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:
so I wrote this little tutorial, to achieve local rely js, test report diagramming. Procedure and works as follows:
-
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 .
-
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:
the extracted files placed just created js folder:
-
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 .
-
The reportng-1.1.5.jar file decompression, after extracting open like this:
-
We turn into the \ org \ uncommons \ reportng \ templates \ html, you can see the following files:
-
We right-click on overview.html.vm, choose to use notepad editor:
-
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>
Save.
- 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.
- 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:
- 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.
3D demo below:
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的你共同进步。