Skip to main content

Cucumber Pretty and Monochrome Reports

The first plugin, we will talk about is Pretty.  This provides more verbose output. To implement this, just specify plugin = “pretty” in CucumberOptions. This is what the code looks like:

    plugin = {"pretty"},
    features = {"features"},
    monochrome = true,
    strict = true,
    dryRun = false,
    tags = {"@classobjects"}

pretty display report in console by default. Output should look like below when monochrome = false. If the monochrome option is set to false, then the console output is not as readable as it should be.

[36mAnd [0m[36mI fill in [0m[36m[1m"input[id='email']"[0m[36m with [0m[36m[1m""[0m [90m# com.pb.cucumbertest.stepdefinitions.StepDefinitions.i_fill_in_with(java.lang.String,java.lang.String)[0m
  [36mAnd [0m[36mI click on [0m[36m[1m"button[type='submit'] span i"[0m                        [90m# com.pb.cucumbertest.stepdefinitions.StepDefinitions.i_click_sign_in_button(java.lang.String)[0m

[31mFailed scenarios:[0m
[31mfile:///Users/tarungoswami/git/cucumbertest/cucumbertest/features/Login.feature:23[0m# Verify Forgot Password Functionality

3 Scenarios ([31m1 failed[0m, [32m2 passed[0m)
11 Steps ([31m1 failed[0m, [36m2 skipped[0m, [32m8 passed[0m)

Now, Let's set the monochrome as true and see the output in console. Now, it's more readable.

And I fill in "input[id='email']" with "" # com.pb.cucumbertest.stepdefinitions.StepDefinitions.i_fill_in_with(java.lang.String,java.lang.String)
  And I click on "button[type='submit'] span i"                        # com.pb.cucumbertest.stepdefinitions.StepDefinitions.i_click_sign_in_button(java.lang.String)

Failed scenarios:
file:///Users/tarungoswami/git/cucumbertest/cucumbertest/features/Login.feature:23# Verify Forgot Password Functionality

3 Scenarios (1 failed, 2 passed)
11 Steps (1 failed, 2 skipped, 8 passed)

Submitted by tgoswami on August 30, 2020

Tarun has 11+ years of experience in Quality Assurance in different domains like Banking, E-commerce, Health and Education.


At ProgramsBuzz, you can learn, share and grow with millions of techie around the world from different domain like Data Science, Software Development, QA and Digital Marketing. You can ask doubt and get the answer for your queries from our experts.