xUnit with Jenkins: how to display colors in the Build Console Output?

早过忘川 提交于 2019-12-11 02:59:35

问题


I successfully setup CasperJS test suite exporting to an xUnit XML file that way:

$ casperjs test googletesting.js --xunit=log.xml

I managed to automate these tests through Jenkins thanks to the xUnit Plugin.

I even managed to setup emails notifications when a build fails thanks to [Mail Watcher Plugin][3] which is great !

The only problem is the format of the output, it's a bit messy. In the build console output and in my email notifications I see the following:

[37;46;1mTest file: tests.js[0m
[33m# TEST XXX[0m
[32;1mPASS[0m #aaa found
[32;1mPASS[0m #bbb found
[32;1mPASS[0m ccc found
[32;1mPASS[0m ddd found

In the xUnit Plugin page, it says:

For each xUnit tool, an embedded style sheet is used. However, the plugin also enables you to use a custom style sheet for your own tool such as WebUI

Is there a way to display the build output so that it's styled properly with beautiful colors ?


回答1:


Hurray !

Actually, describing my problem made me investigate and find a solution !

I just needed to install the AnsiColor Plugin and check the Color ANSI Console Output box from the Build Environment !

More info here: http://code.dblock.org/the-jenkins-ansicolor-plugin-youve-all-been-waiting-for

It now displays beautiful colors in my Console Output.

Still shitty in my email notifications but who cares ?...

Hope it can help !



来源:https://stackoverflow.com/questions/22066333/xunit-with-jenkins-how-to-display-colors-in-the-build-console-output

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!