简体   繁体   English

抑制黄瓜报告中的 Java 异常堆栈跟踪

[英]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我在 Selenium Webdriver 脚本中使用 Cucumber-jvm,并且 Cucumber 报告输出格式设置为 html 格式

@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.当任何测试失败时,完整的堆栈跟踪将显示在 HTML 报告文件中,如下所示。

在此处输入图片说明

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"}
)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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