发生异常时,JBehave不会失败

问题描述 投票:1回答:4

我正在使用JBehave来运行使用WebDriver编写的测试。 Maven用于自动化构建过程。现在,当我运行测试并且它们失败时,即抛出关于超时的异常等,整个构建不会中断。

以下是示例输出,但有异常:

pastebin

任何人都可以告诉我为什么在此之后构建不会失败以及如何使其失败?如果您需要更多信息,请告诉我。

java maven build jbehave
4个回答
0
投票

设置org.jbehave.core.configuration.Configuration对象时,添加:

myConfiguration.usePendingStepStrategy(new FailingUponPendingStep())

0
投票

在我的项目中,我使用maven-failsafe-plugin来执行测试,我遇到了同样的问题。解决方案是为故障安全添加验证阶段:

<plugins>
  <plugin>
    <groupId>org.apache.maven.plugins</groupId>
    <artifactId>maven-failsafe-plugin</artifactId>
    <executions>
        <execution>
        <id>failsafe-verify</id>
        <phase>verify</phase>
        <goals>
            <goal>verify</goal>
        </goals>
        </execution>
    </executions>
  </plugin>
</plugins>

0
投票

虽然迟了5年,而实际上并没有回答2012年提出的问题,但jBehave 4.0有一个错误,Maven运行do not trigger a failure from Maven when using jBehave 4.0+

因此,如果您在2017年或2018年从谷歌搜索到这里,请查看机票,因为它可能包含您的问题的答案(截至2017年撰写时,“降级至3.9.5 ...”)


0
投票

可能是设置以下属性可以帮助:-Dignore.failure.in.view=false

© www.soinside.com 2019 - 2024. All rights reserved.