【发布时间】:2019-10-29 11:48:24
【问题描述】:
我正在对一个 android Fragment 进行一些 UI 测试,我的代码中有以下字符串:
textView.text = Html.fromHtml("$updateText <u>Change</u>?")
在我的测试中,我有这个代码:
recoverPasswordAssert{
checkTextIsVisible("Number format. Change?")
}
当我运行测试时,会发生此错误:
androidx.test.espresso.NoMatchingViewException: No views in hierarchy found matching: with text: is "Number format. Change?"
我认为它缺少片段代码中的 HTML 标签,但是如何在 Espresso 测试中获取标签?
【问题讨论】:
-
您是否尝试过:“数字格式。更改?”在您的 checkTextIsVisible() 中查看它是否正在寻找它?实际文本的呈现方式可能与底层
String不同。 -
感谢您的评论。是的,我尝试了,但我收到了这个错误:
androidx.test.espresso.NoMatchingViewException: No views in hierarchy found matching:
标签: android html testing automated-tests android-espresso