简体   繁体   中英

Suppress Java Exception Stacktrace in cucumber Reports

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.

在此处输入图片说明

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?

Change format option with "plugin"

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM