Sub*_*bby 39 android android-espresso
很简单,我怎么说如果一个给定TextView
包含一个特定的字符串Espresso
.
相当于: myStrings.contains("Subby");
476*_*ick 58
您可以使用Hamcrest库.它有一个方法containsString.我相信它在Espresso库中.
您可以在类中静态导入它:
import static org.hamcrest.core.StringContains.containsString;
Run Code Online (Sandbox Code Playgroud)
在TextView上的方法中使用containsString:
textView.check(matches(withText(containsString("Test"))));
Run Code Online (Sandbox Code Playgroud)
Peh*_*laj 17
使用 withText
onView(...).check(matches(withText("Subby")));
onView(withId(R.id.textView)).check(matches(withText("Subby")));
Run Code Online (Sandbox Code Playgroud)
归档时间: |
|
查看次数: |
19831 次 |
最近记录: |