110 likes | 284 Views
Automation Lifecycle of Mobile Applications. Ashish Mishra. Agenda:. Why automate? Automation Lifecycle Application building Application installation Launching applications and tests Collecting test logs and results Result reporting. Demos Q&A. Why Automate:. Multiple Phone models
E N D
Automation Lifecycle of Mobile Applications Ashish Mishra
Agenda: • Why automate? • Automation Lifecycle • Application building • Application installation • Launching applications and tests • Collecting test logs and results • Result reporting. • Demos • Q&A
Why Automate: • Multiple Phone models • Multiple Operating systems • Multiple Application versions • Multiple Carriers • Device specific features • Complex API testing • Large number of test cases
Automation Lifecycle: Building applications • Jenkins – an extendable continuous Integration server. • Install Apache tomcat web server • Get Jenkins.war from Jenkins-ci.org and deploy. • Jenkins + Android: • Setup: Eclipse + Android SDK + ADT Plugin • Android App –android update project –p <path to android app> • Test App – android update test-project –m <path to App> -p <path to TestApp> • Build the android projects using: “ant clean debug” • Jenkins + iOS: • Setup: Mac + Xcode + iOS SDK • Build iOS project using: “xcodebuild -configuration ${BUILD_TYPE} -target ${TARGET_NAME} -sdk ${SIMULATOR_OR_IOS_SDK}”
Automation Lifecycle: Installing Applications • Android: Android SDK provides “adb” which can be used to install/uninstall applications from simulator/devices. • adb [-e | –d <device_id>] install <path to .apk> • adb [-e | –d <device_id>] uninstall <application id> • Non-Jailbroken iOS devices: • Get sources from libimobiledevice.org and compile to create “ideviceinstaller” • This can be used to install/uninstall “IPAs” to any iOS device from command line. • Jailbroken iOS devices: • Install SSH server from Cydia App store. • Unzip IPA, modify Info.plist file to register for URL handler and copy inside device.
Automation Lifecycle: Running Applications and launching tests • Android: Applications can be launched from command line in emulators/devices using: • adb shell am start –n com.google.android.contacts/.ContactsActivity –e <Key> <Value> • Jailbroken iOS device: Application need to register as an URI handler. • Install “Erica utilties” from Cydia app store. • Ssh into the device and use following command : uiopen testapp:// • Non-Jailbroken iOS device: The only option of launching apps from command line is using: • $ instruments -t /Developer/Platforms/iPhoneOS.platform/Developer/Library/Instruments/PlugIns/AutomationInstrument.bundle/Contents/Resources/Automation.tracetemplate <path-to-your-app>/<appname>.app -e UIASCRIPT <path-to-js-test-file>
Automation Lifecycle: Collecting test results and logs • Android: • To fetch logs and files from device to desktop: • adb pull <source path on device> <destination on desktop> • Jailbroken iOS devices: • Use scp to pull back results from device to desktop. • Non-Jailbroken iOS devices: • Fuse4x allows you to mount iOS device’s document directory on the desktop machine by the following command : • Ifuse <mount point> -u <udid of iOS device> --appid <application ID>
Automation Lifecycle: Test result reporting • Jenkins provides in-built support for Junit test result xml reports. • Supply the path of test result in junit format in the jenkins job : • Graphs, trends and drill down options are also available. • Jenkins can be configured to preserve selective set or a predefined number of test results.