Udemy REST Assured free

Cucumber Options(@CucumberOptions): Monochrome

We use monochrome option inside @CucucmberOptions annotation. This option can either set as true or false.

import org.junit.runner.RunWith;
import io.cucumber.junit.Cucumber;
import io.cucumber.junit.CucumberOptions;

@RunWith(Cucumber.class)
@CucumberOptions(
		plugin = {"pretty", "html:target/cucumber"},
		features = {"features"},
		glue={"com.pb.cucumbertest.stepdefinitions"},
		monochrome = false
		)

public class Runner {

}

If it is set as 

true: it means that the console output for the Cucumber test are much more readable and remove any unreadable character. false: then the console output is not as readable as it should be. 

Method Signature: public abstract boolean monochrome
Returns: whether or not to use monochrome output
Default: false

Example: Monochrome option inside Cucumber Options

Scenario: For below scenario step definition does not exist for And I follow "Contact us"

Feature: As an Ecommerce store owner,

  @regression
  Scenario: Fill in Contact Us form
    Given I am on the home page
    And I follow "Contact us"
    When I fill "email address" with "goswami.tarun77@gmail.com"

Output when monochrome is false

monochrome false

Output when monochrome is true

monochrome true

Video Tutorial: How to use Monochrome option inside Cucumber Runner Class