我的JBehave配置如下:
@RunWith(SpringAnnotatedPathRunner.class)
@UsingPaths(searchIn = "src/test/resources")
@Configure(storyReporterBuilder = MyReportBuilder.class, pendingStepStrategy = FailingUponPendingStep.class)
@UsingEmbedder(embedder = SameThreadEmbedder.class, ignoreFailureInStories = false, ignoreFailureInView = false)
@UsingSpring(resources = "classpath:stepsConfiguration.xml")
@UsingSteps
public class SampleIT extends JUnitStory {
public static class SameThreadEmbedder extends Embedder {
public SameThreadEmbedder() {
useExecutorService(MoreExecutors.sameThreadExecutor());
}
}
public static class MyReportBuilder extends StoryReporterBuilder {
public MyReportBuilder() {
withFailureTrace(true).withFormats(HTML, STATS);
}
}
}
现在我想要一些允许在失败的测试中截取屏幕截图的东西。我在网上找到了一些样本,但我无法将它们放到我的配置中。有人能告诉我如何实现这个目标吗?
答案 0 :(得分:0)
我对这一切都很陌生,但你有这样的尝试吗?
WebDriverScreenshotOnFailure screenshotOnFailure = new WebDriverScreenshotOnFailure(driverProvider);