这是我的代码:
@MediumTest
@RunWith(AndroidJUnit4.class)
public class MyActivityTest extends BaseRobot {
@Rule
public ActivityTestRule<MyActivity> mActivityRule = new ActivityTestRule<>(MyActivity.class);
@Test
public void testManifestListVisible() throws Exception {
allOf(withId(R.id.llContainer), isDisplayed());
}
@Test
public void testManifestBtnVisible() throws Exception {
isViewDisplayed(R.id.btManageManifest);
}
@Test
public void testManifestBtn() throws Exception {
clickButton(R.id.btManageManifest);
}
android.support.test.espresso.NoMatchingViewException: No views in hierarchy found matching: with id:com.xxx.xxx:id/myBtnId
注意:我使用的是这个版本的libs
espressoVersion = '3.0.1'
hamcrestVersion = '1.3'
supportAnnotationsVersion = '23.1.0'
testRunnerVersion = '1.0.1'
testRulesVersion = '1.0.1'
提前谢谢!