Test Execution of Android applications in Testsigma(or in General) requires a few characteristic details about the Application in order to locate the Application and the specific feature in the Application that is to be tested. They are:
- App Package Name
- App Activity Name
Every Android app has a unique identifier that looks like a Java package name, such as "com.example.myapp". This ID uniquely identifies your app on the device and in Google Play Store.
Furthermore, Each Android Application contains a number of Activities or Pages and each Activity contains a number of elements such as fields or buttons that we need to test.
A simpler analogy is,
"An Activity in an Android Application is to a Web page in a Web Application or Website"
Testing requires the App Package name to locate the Application and App Activity name to pinpoint the Page to be tested.
Finding App Package and Activity
We can find the App details using the Android Debugging Bridge (ADB) interface in a Command Prompt (Windows) or Terminal (Linux/Mac).
Prerequisite for ADB
- Android SDK should be installed and set up on the Computer.
Let us try finding the details of the Whatsapp app in this case. Please follow the steps given below:
1. Firstly, connect your Android device or emulator to the PC/Mac and open the App whose details you want to inspect i.e Whatsapp.
2. Open a Command Prompt or Terminal window and use ‘adb devices‘ command to see the list of connected devices. A list of Android devices connected to the Computer is displayed along with their device IDs as shown below:
For now, we have only one device connected to this System.
3. Finally, type the below-given command to get the information about the currently open application, i.e in our case, WhatsApp.
adb shell dumpsys window | grep -E mCurrentFocus
The Android Application Package name and Application Activity name are shown as given below:
Here, the part before the '/' character i.e com.whatsapp is the Package name and the part after that i.e com.whatsapp.HomeActivity is the Activity name.
Note: We need to make sure that the WhatsApp application is opened on the device and device is not locked before the procedure. We can use the same method for finding the details of any Application installed on the device.
Info: You can also confirm the package name of an Application in the More Details section of the Application details page in Google Play Store.
Welcome to the era of #SmartTestAutomation!