【发布时间】:2020-05-16 22:13:58
【问题描述】:
我经常使用 testNG 的 assertTrue 来验证交易是否正确
public void verifyAmount(WebElement element, String someText){
assertTrue(element.getText().contains(someText));
}
当它失败时它会说
java.lang.AssertionError: did not expect to find [true] but found[false]
是否可以更改断言错误以说明究竟出了什么问题,而不仅仅是真/假陈述?是否可以使该消息更具体? 有没有办法让断言错误说:
java.lang.AssertionError: did not expect to find [10.000 $] but found[3000 $]
【问题讨论】:
-
因为它并不总是真正相等的,该元素对原始字符串有添加,所以我必须使用“包含”
标签: java testng appium assert assertion