What is the best way to disable color output for my Cucumber JUnit tests when they are run by a build machine?
It is possible to set monochrome = true
in the @CucumberOptions
annotation. The problem with that is, running the Tests locally should contain Color.
Setting -Dcucumber.options.monochrome=true
is not working, for whatever reason.
Is there any way to set/override this from the command line?
Monochrome True in CucumberWhen monochrome value set to true, It will make console output for the Cucumber test much more readable and remove any unreadable character. Now compare the output with above output where monochrome value is set to false, no such unreadable characters are included now.
What is Cucumber Options? In layman language, @CucumberOptions are like property files or settings for your test. Basically @CucumberOptions enables us to do all the things that we could have done if we have used cucumber command line.
@RunWith annotation tells JUnit that tests should run using Cucumber class present in 'Cucumber.
Found the solution.
As stated here https://cucumber.io/docs/cucumber/api/#list-configuration-options
Providing -Dcucumber.ansi-colors.disabled=true
solves the issue.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With