ADB is the soul in Appium testing, without it; we can’t proceed with a single step. Well, hope you enjoyed reading our last article on top Git interview questions; It contains some Git commands as well. Today we are going to discuss some of the useful and most important ADB Commands which is very helpful when we perform Mobile testing using Appium.
What is ADB?
ADB stands for Android Debug Bridge, which is a command-line terminal to establish communication with mobile emulators and real mobile devices.
Where to find ADB tools?
SDK folder gets added to your machine after you install SDK. So, the adb.exe tool comes altogether with SDK inside the platform-tools folder.
Alternatively, open command line and type command: where adb.
This command will show the path of the adb.exe tool.
Pre-Requisites
Before you run ADB commands, make sure the following listed configurations are completed:
- Enable USB debugging on your devices
- Connect your device with your computer
Top Appium Tutorials Suggestions
List of ADB Commands
Let’s discuss ADB commands according to their usability.
Here we go!
ADB Commands for Device Configuration
ADB Command to find a list of connected devices
adb devices
ADB Command to run in the terminal of host Android device
adb shell
ADB Command to switch to USB mode
adb usb
ADB Command to start TCP IP Connection
adb tcpip [portNo]
ADB Command to connect devices over Wi-Fi
adb connect [device’s IP address]
ADB Command to check ADB’s version
adb version
ADB Command to display logs of connected devices
adb logcat
ADB Commands for Installing & Updating Apps
ADB Command to install APK or package
adb install [package name or apk’s path]
adb –e install [file.apk[ (- e used for active emulator)
adb –d install [file.apk[ (- d used for connected USB)
ADB Command to uninstall APK of package
adb uninstall [package name or apk’s path]
ADB Command to update the app
adb install –r [apk]
ADB Commands to get Android App Package & App Activity
adb devices adb shell dumpsys window windows | grep –E ‘mCurrentFocus|mFocusedApp’
ADB Commands for file sharing
ADB Command to copy files from phone to computer
adb pull <source folder><destination folder>
ADB Command to send files from computer to phone
adb push <source folder><destination folder>
ADB Commands for server
adb start- server (It starts the server, if not running) adb kill-server (It terminated the adb server)
These are some of the useful commands for Appium testing. Click here to refer to the ADB documents for more knowledge on ADB commands. This link is the reference link of ADB documents on commands.
Hope you enjoyed reading this article. If you have any queries or suggestion then feel free to connect with us, or, post your queries directly in the comment section below. Do not forget to join our Facebook group for the latest updates on Test Automation, Selenium & Appium.