Pages

Friday, 22 July 2022

ADB Commands for Mobile Testing with Appium

 


Mobile Automation Testing Appium Interview Q&A SET - 01

How to Create an Android Emulator Device

Mobile Automation Testing Appium Interview Q&A Set-02



ADB Commands - Appium | Mobile Automation

In this Post we will learn about must-know ADB commands for appium and how we can use adb commands from command line prompt.  Because these are basic commands automation engineers should know. You can learn the below adb commands:

  • Adb start-server
  • Adb kill-server
  • Adb version
  • Adb devices
  • Adb install
  • Adb logcat
  • adb reboot-recovery (reboot device into recovery mode)
  • adb get-statŠµ (print device state)
  • adb push <local> <remote> (copy file/dir to device)
  • adb help (list all commands)
  • adb uninstall com.myAppPackage

What is ADB commands?

ADBADB stands for Android Debug Bridge. It is a command line tool that lets us communicate with an Android device or an emulator. It is a client-server program that includes three components:
  • A client that runs on our machine. You can invoke a client by issuing an adb command.
  • Daemon, which runs as a background process on each emulator or device instance. It by default runs on port number 5037
  • server, which runs as a background process on our machine. It manages communication between the client and the adb daemon running on an emulator or device.

ADB Commands for Mobile Testing

1. Adb start-server: This command checks whether the adb server is running and starts it, if not running. Sometimes adb servers are not started or killed. At that time we should use this command.


 command:  adb start-server




2. adb kill-server: This command terminates the adb server.  In some cases, like what you are not able to find, your device is not listing or having issues with the adb server. we should use this command to kill the existing instance and again use the adb start-server command to start freshly.

Command: adb kill-server




******************

What are the Locators used for Mobile Automation Testing?


Ans: Click Here For Mobile Testing Locators


**************************



3. adb version: This command prints the adb version number


command: adb version





4. adb devices: This command prints the status information of all the attached devices. When you give the udid or device name in your appium script, you should execute this command to know the device name and udid.

Command: adb devices



This displays the following information in the format:
Serial Number   State
6a24as54            device

Serial Number: A string created by adb to uniquely identify an emulator/device
State: The connection state of the instance. It can be offline, device, no device
  • Offline : The device is not connecting or not responding
  • device : The device is connected to the adb server
  • no device : There is no device connected to the adb server

5. Adb install: This command will install the apk file on the attached device / emulator. Whenever you want to install the apk file from your computer, connect your device and you can use this command to install apk by giving the path.

Command: adb install <local_path_to_apk>




Note: Emulators should be up & running before firing adb install command. In the above screen shot emulator-5554 is displayed with device status, it means it is up & running.
Note: the path of my APK file is D:\ ApiDemos-debug.apk

****************************

****************************
6. ADB TAKE SCREENSHOT:

adb shell screencap -p /sdcard/screenshot.png
7. adb logcat: This command will print the logs data to the screen for the purposes of bug reporting. You can also store these logs into a local file using the following command:

Commandadb logcat > <local_path_to_text_file>



A log file will be created at the given location:


8. Uninstalling app from device
adb uninstall com.myAppPackage
adb uninstall <app .apk name>
adb uninstall -k <app .apk name> -> "Uninstall .apk withour deleting data"

**********************

REVISION:==>

==>. How we can verify the Appium installation, what is Appium doctor?


Ans:   To verify that all of Appium's dependencies are met we can use appium-doctor.
Install it with commandnpm install -g appium-doctor, then run the appium-doctor command, supplying the --ios or --android flags to verify that all of the dependencies are set up correctly.


==>. What is the default port for Appium?

Ans: 4723 

This port information is important since we will have to direct your test client to make sure to connect to Appium on this port. If we want to change, the port, we can do so by using the -p flag when starting Appium.

==> What are the important Appium Desired Capabilities?

Ans

{

"platformName": "iOS", "platformVersion": "11.0", "deviceName": "iPhone 11", "automationName": "XCUITest", "app": "/path to app" }

==> Mention the Automation engine for android and IOS?

Ans:
Android: UiAutomator2
IOS : XCUITest

Check below link for question and answers with code:

Top API Interview Question 1-10

*************************************************

SeleniumWebdriver Automation Testing Interview Questions:

API Testing Interview Question Set:
https://automationreinvented.blogspot.com/search/label/Rest-API

 
Kubernetes Interview Question Set
https://automationreinvented.blogspot.com/search/label/Kubernetes

 
Docker Interview Question Set
https://automationreinvented.blogspot.com/2020/02/top-18-docker-commands-for-aytomation.html

 
Linux Interview question Set
https://automationreinvented.blogspot.com/search/label/Linux

 
Automation Testing/SDET Framework Design
https://automationreinvented.blogspot.com/search/label/FrameworkDesign


Java Related Interview Question Set

https://automationreinvented.blogspot.com/search/label/Java


GIT Interview Question Set:
https://automationreinvented.blogspot.com/search/label/GIT


Coding Interview Question Set:
https://automationreinvented.blogspot.com/search/label/Coding%20Questions
Mobile Testing Interview Question Set:
https://automationreinvented.blogspot.com/search/label/Mobile%20Testing

Python Interview Question Set for QAE - SDET - SDE:
https://automationreinvented.blogspot.com/search/label/Python
Special Thanks to m-hadimani.

No comments:

Post a Comment