I want to test that when I receive push, Notification will be showing up. And it might be as well to check its properties (like title, set intent and so on.)How can I do so? @Beforepublic void setupTest() { mData.putString(PushNotificator.KEY_PUSH_TYPE, PushType.PROJECT_OFFER.toString()); mData.putString(PushNotificator.KEY_PUSH_OBJECT, pushObjectJsonString); mContext = InstrumentationRegistry.getContext();}@Testpublic void projectOfferCreatedFromBundle() { mPushNotificator = new PushNotificator(mContext); mPushNotificator.processPush(mData); onView(withText("111")).check(matches(withText("111"))); //how to find notification?} 解决方案 Espresso UI test framework doesn't see more than actual View. I doubt seriously that you can check any notification with Espresso.For this purpose use another Googles testing framework uiautomator, which is described as:Here you would find how to use it with Espresso: http://qathread.blogspot.com/2015/05/espresso-uiautomator-perfect-tandem.htmlMore information:Documentation(I):https://google.github.io/android-testing-support-library/docs/uiautomator/index.htmlDocumentation(II):http://developer.android.com/intl/es/training/testing/ui-testing/uiautomator-testing.htmlVisit also: Android Testing: UIAutomator vs Espresso 这篇关于意式浓咖啡测试以显示通知的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持! 09-10 20:44