is there any way to test an application which is already installed For Eg. i want to test the calculator or google map application ?
my Current Appium version is 1.3.4.1
Software Quality Assurance & Testing Stack Exchange is a question and answer site for software quality control experts, automation engineers, and software testers. It only takes a minute to sign up.
Sign up to join this communityYes, you could do it. Here is sample approach to accomplish it.
1. First, get the application package name
To get the application package name, use:
adb shell 'pm list package -f' |grep calculator
note the APK file and the package name. For example:
package:/system/app/SecCalculator2/SecCalculator2.apk=com.sec.android.app.popupcalculator
the apk file is /system/app/SecCalculator2/SecCalculator2.apk and the package name is: com.sec.android.app.popupcalculator
2. Get the launch-able Activity name
First, pull the application APK's from devices:
adb pull /system/app/SecCalculator2/SecCalculator2.apk
then use aapt to get the launchable Activity name:
aapt dump badging SecCalculator2.apk
Look for launchable-activity in the results, or use grep to filter it. The result should be similar like this:
launchable-activity: name='com.sec.android.app.popupcalculator.Calculator' label='Calculator' icon=''
On these sample, the launchable activity name is: .Calculator
3. Now, create the DesiredCapabilities
create your desired capability to launch the installed applications. Make sure to match the appPackage and appActivity from the steps above. (this sample is using java).
DesiredCapabilities cap = new DesiredCapabilities();
cap.setCapability(CapabilityType.BROWSER_NAME, "");
cap.setCapability("platformName", "ANDROID");
cap.setCapability("deviceName", "S5");
cap.setCapability("platformVersion", "5.0");
cap.setCapability("appPackage", "com.sec.android.app.popupcalculator");
cap.setCapability("appActivity",".Calculator");
cap.setCapability("noSign", true);
And then, just create the test scripts and automate it.
TO know the activity name and package name of any apps simply download a apkinfo apps from playstore and get the imformation about the apk. and set to the capabilities and run your apps.
Install apk info application from Play Store and check appPackage and appActivity information, then set the same in desired capabilities:
caps["deviceName"] = "Device Emulator"
caps["platformVersion"] = "8.1"
caps["platformName"] = "android"
caps["appPackage"]= "<package>"
caps["appActivity"] = "<activity>"
self.driver = webdriver.Remote("http://localhost:4723/wd/hub", caps)