xUnit with Jenkins: how to display colors in the B

2019-07-09 02:48发布

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条回答
时光不老,我们不散
2楼-- · 2019-07-09 03:13

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 !

查看更多
登录 后发表回答