Unable to import static android.support.test.espresso.contrib.DrawerMatchers.isOpen;

こ雲淡風輕ζ 提交于 2019-12-07 08:18:59

问题


I am using espresso for testing my android application. When am trying to write test cases for navigation drawer menu am unable to import any of these

import static android.support.test.espresso.contrib.DrawerActions.closeDrawer;
import static android.support.test.espresso.contrib.DrawerActions.openDrawer;
import static android.support.test.espresso.contrib.DrawerMatchers.isClosed;
import static android.support.test.espresso.contrib.DrawerMatchers.isOpen;

So please help me from this


回答1:


You may missing in build.gradle espresso-contribdependencies like below:

androidTestCompile "com.android.support.test.espresso:espresso-core:2.2.2"
androidTestCompile 'com.android.support.test:runner:0.5'
androidTestCompile "com.android.support.test.espresso:espresso-intents:2.2.2"
/**
 * AccessibilityChecks
 * CountingIdlingResource
 * DrawerActions
 * DrawerMatchers
 * PickerActions (Time and Date picker)
 * RecyclerViewActions
 */
androidTestCompile("com.android.support.test.espresso:espresso-contrib:2.2.2") {
    exclude group: 'com.android.support', module: 'appcompat'
    exclude group: 'com.android.support', module: 'support-v4'
    exclude group: 'com.android.support', module: 'support-v7'
    exclude group: 'com.android.support', module: 'design'
    exclude module: 'support-annotations'
    exclude module: 'recyclerview-v7'
}

Hope it will help



来源:https://stackoverflow.com/questions/40014465/unable-to-import-static-android-support-test-espresso-contrib-drawermatchers-iso

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!