1

I am using cucumber-jvm for my Selenium Webdriver scripts and the cucumber reports output format is set to html format

@CucumberOptions(
    features = "src/test/resources/features",
    format = {"pretty", "html:target/site/cucumber-pretty",
            "json:target/cucumber.json"}
)

When any test fails, the full stacktrace is displaying on the HTML report file as shown below.

enter image description here

I want to suppress this full stacktrace and replace it with my own message. I have tried this in the below way but didn't helped.

 try
    {
        WebDriverWait wait = new WebDriverWait(driver, 20);
        wait.until(ExpectedConditions.visibilityOf(element));
    }
    catch (Throwable throwable)
    {
        throwable.getMessage();
    }

Is there anyway to get rid of this?

vkrams
  • 7,267
  • 17
  • 79
  • 129
  • Is this a duplicate of http://stackoverflow.com/questions/22714327/how-to-suppress-cucumber-junit-assertion-stack-trace ? – MikeJRamsey56 Mar 02 '16 at 17:34
  • Does this answer your question? [How to suppress Cucumber/Junit assertion stack trace](https://stackoverflow.com/questions/22714327/how-to-suppress-cucumber-junit-assertion-stack-trace) – Pramod Kajla Jan 26 '21 at 10:59

1 Answers1

0

In your cucumber options you have ... format = {"pretty", ... Change format option to "plugin" like this:

@CucumberOptions(
    features = "src/test/resources/features",
    plugin = {"pretty", "html:target/site/cucumber-pretty",
            "json:target/cucumber.json"}
)
Community
  • 1
  • 1
nosequeweaponer
  • 511
  • 10
  • 38