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:

@CucumberOptions(
    plugin = {"pretty"},
    features = {"features"},
    glue={"com.pb.cucumbertest.stepdefinitions"},
    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"goswami.tarun77+7@gmail.com"[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)
1m14.883s

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 "goswami.tarun77+7@gmail.com" # 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)
1m11.792s
Sun, 08/30/2020 - 22:35
Tarun Goswami is a highly experienced professional, currently serving as Technical Lead at a well-established IT services company. With over 12 years of experience across multiple domains, he demonstrates his expertise and passion for the industry through his engaging and informative blog writing in his spare time.

Comments