Original link: http://sqa.stackexchange.com/questions/12373/android-app-testing-with-appium/12382#12382
I suggest the Use adb (Android Debug Bridge) tool (part of the Android SDK). So, install application under test on target Android device or emulator. And you should run application to get the current activity and the package name. So, after running app execute the following commands from command line (ANDROID-SDK/PLATFORM-TOOLS/ADB):
12grep'mcurrentfocus| Focusedapp'
And you'll get something like this:
mCurrentFocus=Window{43270790 u0 com.estrongs.android.pop/com.estrongs.android.pop.view.FileExplorerActivity} mFocusedApp=AppWindowToken{44d67b88 token=Token{435e5990 ActivityRecord{434ee320 u0 com.estrongs.android.pop/.view.FileExplorerActivity t133
So, the current activity is Com.estrongs.android.pop/.view. Fileexploreractivity and application package name are Com.estrongs.android.pop is the this case.
Steps:
- Install APK on device or emulator//mount the apk you want to test.
- Run application//running the apk you want to test.
- Execute from
adb shell
command line//execute adb shell command.
- Execute command to get the current activity from device (shell) Shell://execute the commands below.
dumpsys window windows | grep -E ‘mCurrentFocus|FocusedApp‘
I hope it helps you.
Get the values for App-package and app-activity