如何使用AssertJ软评估为每个软声明故障获取屏幕截图
我想在下面实现: -
CustomSoftAssertJ softly = new CustomSoftAssertJ();
softly.assertThat(actual).isEqualTo(expected); // get screen shot on failure
softly.assertThat(actual).isEqualTo(expected); // get screen shot on failure
softly.assertThat(actual).isEqualTo(expected); // get screen shot on failure
softly.assertThat(actual).isEqualTo(expected); // get screen shot on failure
softly.assertAll();
我正在尝试下面,但它无法正常工作: -
public class CustomSoftAssertJ extends AbstractSoftAssertions {
@Override
public void onAssertionErrorCollected(AssertionError assertionError) {
super.onAssertionErrorCollected(assertionError);
ExtentReport.getTest().fail(assertionError.getLocalizedMessage(),
MediaEntityBuilder.createScreenCaptureFromBase64String(ScreenshotUtils.getBase64Image()).build());
}
}
我看到了Assertj的原始文档,但是我无法理解。 有人可以用简单的例子帮我吗?
I want to achieve below: -
CustomSoftAssertJ softly = new CustomSoftAssertJ();
softly.assertThat(actual).isEqualTo(expected); // get screen shot on failure
softly.assertThat(actual).isEqualTo(expected); // get screen shot on failure
softly.assertThat(actual).isEqualTo(expected); // get screen shot on failure
softly.assertThat(actual).isEqualTo(expected); // get screen shot on failure
softly.assertAll();
And I am trying below and it is not working: -
public class CustomSoftAssertJ extends AbstractSoftAssertions {
@Override
public void onAssertionErrorCollected(AssertionError assertionError) {
super.onAssertionErrorCollected(assertionError);
ExtentReport.getTest().fail(assertionError.getLocalizedMessage(),
MediaEntityBuilder.createScreenCaptureFromBase64String(ScreenshotUtils.getBase64Image()).build());
}
}
I saw the original documentation from AssertJ, However I could not get it.
Could someone help me out here with simple example?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论