serenity-bdd / serenity-maven-plugin

19 stars 21 forks source link

disable technicolor yawn #77

Closed SiKing closed 3 years ago

SiKing commented 4 years ago

When I run my tests and produce a Serenity report, the final statistics are colourized.

Unfortunately, when this runs in Jenkins, the final results look something like:

[INFO] --- serenity-maven-plugin:2.2.13:aggregate (default) @ ... ---
[INFO] Test results for 162 tests generated in 4 secs in directory: file:/var/lib/jenkins/jobs/.../
[INFO] -----------------------------------------
[INFO]  SERENITY TESTS : ERROR
[INFO] -----------------------------------------
[INFO] | Tests executed         | 162
[INFO] | Tests passed           | 143
[INFO] | Tests failed           | 5
[INFO] | Tests with errors      | 11
[INFO] | Tests compromised      | 0
[INFO] | Tests pending          | 0
[INFO] | Tests ignored/skipped  | 3
[INFO] ------------------------ | --------------
[INFO] | Total Duration         | 6h 42m 8s
[INFO] | Fastest test took      | 001ms
[INFO] | Slowest test took      | 18m 7s
[INFO] -----------------------------------------

According to documentation, this is supposed to be disabled by default. There is even a comment there:

This feature can cause errors if it is enabled for builds under Jenkins.

SiKing commented 3 years ago

@wakaleo I tried to look at this today - slow day at work. :p

I think the bug is in AsciiColors. My guess is that the return value on L22 should be:

ThucydidesSystemProperty.SERENITY_CONSOLE_COLORS.booleanFrom(environmentVariables, false);

But this made no difference for me.

I think this output comes from the ResultChecker, but changing anything there (like some of the output text) seems to have no effect on the output from my test runs.

Am I way off here?

SiKing commented 3 years ago

Even explicitly setting serenity.console.colors = false has no effect on this.

What am I doing wrong?

SiKing commented 3 years ago

I figured out my mistake: I need to build both serenity-core (with the changes), as well as serenity-maven-plugin (which has no changes) with the new serenity-core.

SiKing commented 3 years ago

Well, I figured out how to turn off the colours with the MR. But I cannot turn them back on with serenity.console.colors = true.

SiKing commented 3 years ago

I think this problem is mostly resolved.