android-uiautomator

Cannot resolve symbol 'AndroidJUnit4'

≯℡__Kan透↙ 提交于 2019-11-27 09:30:42
问题 Obviously I need the correct import statment to solve this problem. According to the docs for AndroidJUnit4, this should be import android.support.test.runner.AndroidJUnit4; When I do that, Android Studio highlights runner in red and complains "Cannot resolve symbol 'runner'". Background I got to this point by following the tutorials on the Android Developer site for setting up tests using UI Automator. The first problem I encountered was that com.android.support:support-v4:22.2.0 and com

Android Testing: UIAutomator vs Espresso

限于喜欢 提交于 2019-11-27 05:27:28
问题 I was seeking for test frameworks for Android UI automation and I stumbled upon UI Automator and Espresso and this is the part I am confused about - Both are maintained by Google Both are used for functional UI testing Both are Android only frameworks So my questions/doubts here are - What is the major difference between UI Automator and Espresso ? Will the source code have to be modified to integrate any of these frameworks? Does one framework hold any advantage over the other? If yes, then

Set different minSdkVersion for testAndroid than for main app

*爱你&永不变心* 提交于 2019-11-27 01:13:55
问题 Is it possible to set a different minSdkVersion for tests than for the app itself? I ask because I want to use the new Test Support Library and UI Automator for testing. However, this is only available on API 18+. At the same time, I still want to support older versions of Android, albeit not as thoroughly tested. What do I need to add to my build.gradle file in order to do this? To clarify, I am using Android Studio and the "new" Gradle-based project structure. 回答1: I got this from the new

Error obtaining UI hierarchy Error while obtaining UI hierarchy XML file: com.android.ddmlib.SyncException: Remote object doesn't exist

怎甘沉沦 提交于 2019-11-26 21:19:38
问题 I am testing my app with adb, but i get this error when i execute "dump view hierarchy for uiautomator": Error obtaining UI hierarchy Error while obtaining UI hierarchy XML file: com.android.ddmlib.SyncException: Remote object doesn't exist! My adb version is 1.0.36 and my android version is 6.0.1. This error comes launched only when in the interface there is a dynamic element that is in motion. thank you in advance. 回答1: The best way is to kill the adb server and start it again. sudo adb

Is there a way to get current activity's layout and views via adb?

时光毁灭记忆、已成空白 提交于 2019-11-26 02:10:00
问题 For environment reasons I can only use adb commands. Is there a way to get the current layout attributes like id , position , text etc ? Similar to what uiautomatorviewer shows. 回答1: Use adb shell uiautomator dump command: Usage: uiautomator <subcommand> [options] Available subcommands: help: displays help message runtest: executes UI automation tests runtest <class spec> [options] <class spec>: <JARS> < -c <CLASSES> | -e class <CLASSES> > <JARS>: a list of jar files containing test classes