草庐IT

android.support.test.espresso.NoActivityResumedException : No activities in stage RESUMED

我正在尝试为我的Activity编写测试用例。我有几个Activity,其中一个没有问题,而当我尝试对其他ActivityTest类运行测试时出现以下错误。android.support.test.espresso.NoActivityResumedException:NoactivitiesinstageRESUMED.Didyouforgettolaunchtheactivity.(test.getActivity()orsimilar)?这是我所有测试用例都失败的类:@RunWith(AndroidJUnit4.class)@LargeTestpublicclassLocatin

android - 如何使用 Espresso 2.2 在 Android 中测试查看寻呼机滑动手势

我正在使用Espresso2.2为Viewpager编写自动化测试,我需要在其中测试滑动功能。我写了下面的代码:@LargeTestpublicclassFirstActivityTest{@RulepublicActivityTestRulefirstActivityTestRule=newActivityTestRule(FirstActivity.class);@TestpublicvoidtestViewPagerSwipeFunctionality()throwsInterruptedException{onView(withId(R.id.tv_commu)).check(

android - 使用 onView(withId(...)) 时使用 Espresso 单击操作栏中的菜单项

我正在使用Espresso进行测试,首先我打开操作栏:openActionBarOverflowOrOptionsMenu(getInstrumentation().getTargetContext());到目前为止一切正常,但我想点击一个选项菜单:onView(withId(R.id.action_menu)).perform(click());菜单布局xml有一个id为“action_menu”的选项。我得到一个错误:android.support.test.espresso.NoMatchingViewException:Noviewsinhierarchyfoundmatchi

android - espresso onView 性能不一致

我正在使用Junit4和Espresso进行测试。我在espresso测试中遇到了一个奇怪的问题——当我调用onView时,有时一切都会按预期执行,但有时我的测试会卡住,60秒后我会得到类似“android.support.test.espresso.AppNotIdleException:Looped在60秒内进行63次迭代。以下空闲条件失败ASYNC_TASKS_HAVE_IDLED"例如:onView(withId(R.id.zone_button_continue)).perform(click());onView(withId(R.id.loginButton)).check