编辑:更新了描述和错误消息并添加了一些图像.还是有这个问题.
运行espresso测试时,我发生了很多次奇怪的错误.经过几次成功的测试运行后,测试开始失败并出现以下异常:
06-23 13:04:48.438 info TestRunner failed: WhenNavigatingToReportsThenCorrectViewShouldBeShown(com.myapp.ui.views.MainActivityTest)
06-23 13:04:48.439 info TestRunner ----- begin exception -----
06-23 13:04:48.441 info TestRunner android.support.test.espresso.NoActivityResumedException: No activities in stage RESUMED. Did you forget to launch the activity. (test.getActivity() or similar)?
06-23 13:04:48.441 info TestRunner at dalvik.system.VMStack.getThreadStackTrace(Native Method)
06-23 13:04:48.441 info TestRunner at java.lang.Thread.getStackTrace(Thread.java:580)
06-23 13:04:48.441 info TestRunner at android.support.test.espresso.base.DefaultFailureHandler.getUserFriendlyError(DefaultFailureHandler.java:82)
06-23 13:04:48.441 info TestRunner at android.support.test.espresso.base.DefaultFailureHandler.handle(DefaultFailureHandler.java:53)
06-23 13:04:48.441 info TestRunner at android.support.test.espresso.ViewInteraction.runSynchronouslyOnUiThread(ViewInteraction.java:184)
06-23 13:04:48.441 info TestRunner at android.support.test.espresso.ViewInteraction.doPerform(ViewInteraction.java:115)
06-23 13:04:48.441 info TestRunner at android.support.test.espresso.ViewInteraction.perform(ViewInteraction.java:87)
06-23 …Run Code Online (Sandbox Code Playgroud) 在过去的一周里,我一直在寻找有关 Android 端到端测试的有用信息。虽然我找到了 UI Automator,但它并没有引起我的注意。
我正在开发一个应用程序,它的快乐路径包含 6 个活动。我想在主屏幕中创建我的 Booking 对象并将其移动到快乐路径以检查其状态。我想我可以用MockWebServer模拟服务器响应。我看到的所有样本都在测试一项活动。
所以我的问题是我能否在一次测试中测试所有这些活动(快乐路径)?如果是,是否有任何样本?