mobile automation made awesome - Appium: Mobile App ...appium.io/jqueryuk.pdf · Ecosystem &...
Transcript of mobile automation made awesome - Appium: Mobile App ...appium.io/jqueryuk.pdf · Ecosystem &...
![Page 1: mobile automation made awesome - Appium: Mobile App ...appium.io/jqueryuk.pdf · Ecosystem & Integrations Project Lead & Architect Unit/Functional Mobile Testing with Appium and Sauce](https://reader031.fdocuments.net/reader031/viewer/2022021511/5ac024f07f8b9ae45b8bd434/html5/thumbnails/1.jpg)
mobile automation made awesome
Jonathan Lipps • Director of Ecosystem & Integrations • Sauce Labs
@AppiumDevs • @jlipps • @saucelabs
jQueryUK Workshop • Oxford, UKMay 16 2014
![Page 2: mobile automation made awesome - Appium: Mobile App ...appium.io/jqueryuk.pdf · Ecosystem & Integrations Project Lead & Architect Unit/Functional Mobile Testing with Appium and Sauce](https://reader031.fdocuments.net/reader031/viewer/2022021511/5ac024f07f8b9ae45b8bd434/html5/thumbnails/2.jpg)
Ecosystem &Integrations
Project Lead &Architect
Unit/Functional Mobile Testing with Appium and Sauce Labs
Jonathan Lipps • Director of Ecosystem & Integrations • Sauce Labs
@AppiumDevs • @jlipps • @saucelabs
http://appium.io/jqueryuk.pdf
![Page 3: mobile automation made awesome - Appium: Mobile App ...appium.io/jqueryuk.pdf · Ecosystem & Integrations Project Lead & Architect Unit/Functional Mobile Testing with Appium and Sauce](https://reader031.fdocuments.net/reader031/viewer/2022021511/5ac024f07f8b9ae45b8bd434/html5/thumbnails/3.jpg)
appium introduction
![Page 4: mobile automation made awesome - Appium: Mobile App ...appium.io/jqueryuk.pdf · Ecosystem & Integrations Project Lead & Architect Unit/Functional Mobile Testing with Appium and Sauce](https://reader031.fdocuments.net/reader031/viewer/2022021511/5ac024f07f8b9ae45b8bd434/html5/thumbnails/4.jpg)
The Dev Cycle ofOptimal Happiness[ ]
![Page 5: mobile automation made awesome - Appium: Mobile App ...appium.io/jqueryuk.pdf · Ecosystem & Integrations Project Lead & Architect Unit/Functional Mobile Testing with Appium and Sauce](https://reader031.fdocuments.net/reader031/viewer/2022021511/5ac024f07f8b9ae45b8bd434/html5/thumbnails/5.jpg)
appium is the cross-platform solution for native and hybrid mobile automation
![Page 6: mobile automation made awesome - Appium: Mobile App ...appium.io/jqueryuk.pdf · Ecosystem & Integrations Project Lead & Architect Unit/Functional Mobile Testing with Appium and Sauce](https://reader031.fdocuments.net/reader031/viewer/2022021511/5ac024f07f8b9ae45b8bd434/html5/thumbnails/6.jpg)
PhilosophyR1. Test the same app you submit to the marketplaceR2. Write your tests in any language, using any frameworkR3. Use a standard automation specification and APIR4. Build a large and thriving open-source community effort
![Page 7: mobile automation made awesome - Appium: Mobile App ...appium.io/jqueryuk.pdf · Ecosystem & Integrations Project Lead & Architect Unit/Functional Mobile Testing with Appium and Sauce](https://reader031.fdocuments.net/reader031/viewer/2022021511/5ac024f07f8b9ae45b8bd434/html5/thumbnails/7.jpg)
![Page 8: mobile automation made awesome - Appium: Mobile App ...appium.io/jqueryuk.pdf · Ecosystem & Integrations Project Lead & Architect Unit/Functional Mobile Testing with Appium and Sauce](https://reader031.fdocuments.net/reader031/viewer/2022021511/5ac024f07f8b9ae45b8bd434/html5/thumbnails/8.jpg)
appium architecture
![Page 9: mobile automation made awesome - Appium: Mobile App ...appium.io/jqueryuk.pdf · Ecosystem & Integrations Project Lead & Architect Unit/Functional Mobile Testing with Appium and Sauce](https://reader031.fdocuments.net/reader031/viewer/2022021511/5ac024f07f8b9ae45b8bd434/html5/thumbnails/9.jpg)
Automation OrchestraApple Instruments & UIAutomation for iOSGoogle UiAutomator for Android (4.2.1 up)Selendroid for older AndroidWebDriver interface
![Page 10: mobile automation made awesome - Appium: Mobile App ...appium.io/jqueryuk.pdf · Ecosystem & Integrations Project Lead & Architect Unit/Functional Mobile Testing with Appium and Sauce](https://reader031.fdocuments.net/reader031/viewer/2022021511/5ac024f07f8b9ae45b8bd434/html5/thumbnails/10.jpg)
appium is an HTTP server that creates and handles WebDriver sessions
![Page 11: mobile automation made awesome - Appium: Mobile App ...appium.io/jqueryuk.pdf · Ecosystem & Integrations Project Lead & Architect Unit/Functional Mobile Testing with Appium and Sauce](https://reader031.fdocuments.net/reader031/viewer/2022021511/5ac024f07f8b9ae45b8bd434/html5/thumbnails/11.jpg)
appium extends the WebDriver protocol with mobile-specific behaviors
![Page 12: mobile automation made awesome - Appium: Mobile App ...appium.io/jqueryuk.pdf · Ecosystem & Integrations Project Lead & Architect Unit/Functional Mobile Testing with Appium and Sauce](https://reader031.fdocuments.net/reader031/viewer/2022021511/5ac024f07f8b9ae45b8bd434/html5/thumbnails/12.jpg)
appium setup
![Page 13: mobile automation made awesome - Appium: Mobile App ...appium.io/jqueryuk.pdf · Ecosystem & Integrations Project Lead & Architect Unit/Functional Mobile Testing with Appium and Sauce](https://reader031.fdocuments.net/reader031/viewer/2022021511/5ac024f07f8b9ae45b8bd434/html5/thumbnails/13.jpg)
Requirements (1/2)• Mac (10.8/10.9)• Android automation works on PC/Linux too
• Node >= 0.10
• Xcode 5.1 with CLI tools and iOS 7.1
![Page 14: mobile automation made awesome - Appium: Mobile App ...appium.io/jqueryuk.pdf · Ecosystem & Integrations Project Lead & Architect Unit/Functional Mobile Testing with Appium and Sauce](https://reader031.fdocuments.net/reader031/viewer/2022021511/5ac024f07f8b9ae45b8bd434/html5/thumbnails/14.jpg)
Requirements (2/2)• Android Developer Tools >= 22• http://developer.android.com/sdk/index.html
• mv to /usr/local/adt
• export ANDROID_HOME=/usr/local/adt/sdk
• add (.bashrc, .zshrc, etc):export PATH=”$PATH:$ANDROID_HOME/tools:$ANDROID_HOME/platform-tools”
![Page 15: mobile automation made awesome - Appium: Mobile App ...appium.io/jqueryuk.pdf · Ecosystem & Integrations Project Lead & Architect Unit/Functional Mobile Testing with Appium and Sauce](https://reader031.fdocuments.net/reader031/viewer/2022021511/5ac024f07f8b9ae45b8bd434/html5/thumbnails/15.jpg)
Install HAXM for Android Speed!• open /usr/local/adt/sdk/extras/intel/Hardware_Accelerated_Execution_Manager/IntelHAXM.dmg
• https://software.intel.com/en-us/android/articles/intel-hardware-accelerated-execution-manager
![Page 16: mobile automation made awesome - Appium: Mobile App ...appium.io/jqueryuk.pdf · Ecosystem & Integrations Project Lead & Architect Unit/Functional Mobile Testing with Appium and Sauce](https://reader031.fdocuments.net/reader031/viewer/2022021511/5ac024f07f8b9ae45b8bd434/html5/thumbnails/16.jpg)
Make an Android Device• android
• Check ‘Intel x86 Atom System Image’ - Android (4.4)
• Click ‘Install 1 package...’
• Tools > Manage AVDs
• New...
![Page 17: mobile automation made awesome - Appium: Mobile App ...appium.io/jqueryuk.pdf · Ecosystem & Integrations Project Lead & Architect Unit/Functional Mobile Testing with Appium and Sauce](https://reader031.fdocuments.net/reader031/viewer/2022021511/5ac024f07f8b9ae45b8bd434/html5/thumbnails/17.jpg)
• AVD Name: workshop
• Device: Nexus S
• Target: Android 4.4
• CPU: Intel/Atom
• Skin: hw controls
• Host GPU
Create the Image
![Page 18: mobile automation made awesome - Appium: Mobile App ...appium.io/jqueryuk.pdf · Ecosystem & Integrations Project Lead & Architect Unit/Functional Mobile Testing with Appium and Sauce](https://reader031.fdocuments.net/reader031/viewer/2022021511/5ac024f07f8b9ae45b8bd434/html5/thumbnails/18.jpg)
Launch AVD• In a new terminal window:• emulator @workshop -netfast
• Go through the new device tour
• $ANDROID_HOME/sdk/tools/emulator @workshop -netfast (without env)
![Page 19: mobile automation made awesome - Appium: Mobile App ...appium.io/jqueryuk.pdf · Ecosystem & Integrations Project Lead & Architect Unit/Functional Mobile Testing with Appium and Sauce](https://reader031.fdocuments.net/reader031/viewer/2022021511/5ac024f07f8b9ae45b8bd434/html5/thumbnails/19.jpg)
Get the workshop code• git clone https://github.com/jlipps/jqueryuk-workshop-2014.git
• cd jqueryuk-workshop-2014
![Page 20: mobile automation made awesome - Appium: Mobile App ...appium.io/jqueryuk.pdf · Ecosystem & Integrations Project Lead & Architect Unit/Functional Mobile Testing with Appium and Sauce](https://reader031.fdocuments.net/reader031/viewer/2022021511/5ac024f07f8b9ae45b8bd434/html5/thumbnails/20.jpg)
Install dependencies• npm install -g appium # no sudo!
• npm install -g cordova
• npm install -g mocha
• npm install .
![Page 21: mobile automation made awesome - Appium: Mobile App ...appium.io/jqueryuk.pdf · Ecosystem & Integrations Project Lead & Architect Unit/Functional Mobile Testing with Appium and Sauce](https://reader031.fdocuments.net/reader031/viewer/2022021511/5ac024f07f8b9ae45b8bd434/html5/thumbnails/21.jpg)
unit tests
![Page 22: mobile automation made awesome - Appium: Mobile App ...appium.io/jqueryuk.pdf · Ecosystem & Integrations Project Lead & Architect Unit/Functional Mobile Testing with Appium and Sauce](https://reader031.fdocuments.net/reader031/viewer/2022021511/5ac024f07f8b9ae45b8bd434/html5/thumbnails/22.jpg)
Run local server• node server.js
• # visit http://localhost:8081
![Page 23: mobile automation made awesome - Appium: Mobile App ...appium.io/jqueryuk.pdf · Ecosystem & Integrations Project Lead & Architect Unit/Functional Mobile Testing with Appium and Sauce](https://reader031.fdocuments.net/reader031/viewer/2022021511/5ac024f07f8b9ae45b8bd434/html5/thumbnails/23.jpg)
![Page 24: mobile automation made awesome - Appium: Mobile App ...appium.io/jqueryuk.pdf · Ecosystem & Integrations Project Lead & Architect Unit/Functional Mobile Testing with Appium and Sauce](https://reader031.fdocuments.net/reader031/viewer/2022021511/5ac024f07f8b9ae45b8bd434/html5/thumbnails/24.jpg)
Run QUnit tests• http://localhost:8081/test.html
• # moviesearch/www/test.html
• # moviesearch/www/test.js
![Page 25: mobile automation made awesome - Appium: Mobile App ...appium.io/jqueryuk.pdf · Ecosystem & Integrations Project Lead & Architect Unit/Functional Mobile Testing with Appium and Sauce](https://reader031.fdocuments.net/reader031/viewer/2022021511/5ac024f07f8b9ae45b8bd434/html5/thumbnails/25.jpg)
Set up Sauce Labs env vars• http://saucelabs.com/signup/plan/free
• http://saucelabs.com/account
• # add to .bashrc or equivalent
• export SAUCE_USERNAME=”myusername”
• export SAUCE_ACCESS_KEY=”xxxxxxxx”
![Page 26: mobile automation made awesome - Appium: Mobile App ...appium.io/jqueryuk.pdf · Ecosystem & Integrations Project Lead & Architect Unit/Functional Mobile Testing with Appium and Sauce](https://reader031.fdocuments.net/reader031/viewer/2022021511/5ac024f07f8b9ae45b8bd434/html5/thumbnails/26.jpg)
Get Sauce Connect• https://saucelabs.com/docs/connect
• cp ~/Downloads/sc-4.2-osx/bin/sc \
/usr/local/bin
![Page 27: mobile automation made awesome - Appium: Mobile App ...appium.io/jqueryuk.pdf · Ecosystem & Integrations Project Lead & Architect Unit/Functional Mobile Testing with Appium and Sauce](https://reader031.fdocuments.net/reader031/viewer/2022021511/5ac024f07f8b9ae45b8bd434/html5/thumbnails/27.jpg)
Start Sauce Connect• sc -u $SAUCE_USERNAME -k $SAUCE_ACCESS_KEY
![Page 28: mobile automation made awesome - Appium: Mobile App ...appium.io/jqueryuk.pdf · Ecosystem & Integrations Project Lead & Architect Unit/Functional Mobile Testing with Appium and Sauce](https://reader031.fdocuments.net/reader031/viewer/2022021511/5ac024f07f8b9ae45b8bd434/html5/thumbnails/28.jpg)
Run JS unit tests on Sauce Labs• ./test/jsunit.sh
• http://saucelabs.com/tests
![Page 29: mobile automation made awesome - Appium: Mobile App ...appium.io/jqueryuk.pdf · Ecosystem & Integrations Project Lead & Architect Unit/Functional Mobile Testing with Appium and Sauce](https://reader031.fdocuments.net/reader031/viewer/2022021511/5ac024f07f8b9ae45b8bd434/html5/thumbnails/29.jpg)
appium test model
![Page 30: mobile automation made awesome - Appium: Mobile App ...appium.io/jqueryuk.pdf · Ecosystem & Integrations Project Lead & Architect Unit/Functional Mobile Testing with Appium and Sauce](https://reader031.fdocuments.net/reader031/viewer/2022021511/5ac024f07f8b9ae45b8bd434/html5/thumbnails/30.jpg)
Start/stop a session
![Page 31: mobile automation made awesome - Appium: Mobile App ...appium.io/jqueryuk.pdf · Ecosystem & Integrations Project Lead & Architect Unit/Functional Mobile Testing with Appium and Sauce](https://reader031.fdocuments.net/reader031/viewer/2022021511/5ac024f07f8b9ae45b8bd434/html5/thumbnails/31.jpg)
Find & Interact with Elements
![Page 32: mobile automation made awesome - Appium: Mobile App ...appium.io/jqueryuk.pdf · Ecosystem & Integrations Project Lead & Architect Unit/Functional Mobile Testing with Appium and Sauce](https://reader031.fdocuments.net/reader031/viewer/2022021511/5ac024f07f8b9ae45b8bd434/html5/thumbnails/32.jpg)
Automate a WebView
![Page 33: mobile automation made awesome - Appium: Mobile App ...appium.io/jqueryuk.pdf · Ecosystem & Integrations Project Lead & Architect Unit/Functional Mobile Testing with Appium and Sauce](https://reader031.fdocuments.net/reader031/viewer/2022021511/5ac024f07f8b9ae45b8bd434/html5/thumbnails/33.jpg)
appium tests
![Page 34: mobile automation made awesome - Appium: Mobile App ...appium.io/jqueryuk.pdf · Ecosystem & Integrations Project Lead & Architect Unit/Functional Mobile Testing with Appium and Sauce](https://reader031.fdocuments.net/reader031/viewer/2022021511/5ac024f07f8b9ae45b8bd434/html5/thumbnails/34.jpg)
Build & run sample apps• ./go_ios.sh
• ./go_android.sh
![Page 35: mobile automation made awesome - Appium: Mobile App ...appium.io/jqueryuk.pdf · Ecosystem & Integrations Project Lead & Architect Unit/Functional Mobile Testing with Appium and Sauce](https://reader031.fdocuments.net/reader031/viewer/2022021511/5ac024f07f8b9ae45b8bd434/html5/thumbnails/35.jpg)
Launch Appium• sudo authorize_ios
• appium
![Page 36: mobile automation made awesome - Appium: Mobile App ...appium.io/jqueryuk.pdf · Ecosystem & Integrations Project Lead & Architect Unit/Functional Mobile Testing with Appium and Sauce](https://reader031.fdocuments.net/reader031/viewer/2022021511/5ac024f07f8b9ae45b8bd434/html5/thumbnails/36.jpg)
Moment of truth...• mocha -t 90000 -R spec test/ios.js
• mocha -t 90000 -R spec test/android.js
![Page 37: mobile automation made awesome - Appium: Mobile App ...appium.io/jqueryuk.pdf · Ecosystem & Integrations Project Lead & Architect Unit/Functional Mobile Testing with Appium and Sauce](https://reader031.fdocuments.net/reader031/viewer/2022021511/5ac024f07f8b9ae45b8bd434/html5/thumbnails/37.jpg)
Upload app to Sauce Storage• ./test/upload.sh
• # or use pre-uploaded app url
![Page 38: mobile automation made awesome - Appium: Mobile App ...appium.io/jqueryuk.pdf · Ecosystem & Integrations Project Lead & Architect Unit/Functional Mobile Testing with Appium and Sauce](https://reader031.fdocuments.net/reader031/viewer/2022021511/5ac024f07f8b9ae45b8bd434/html5/thumbnails/38.jpg)
Run Appium tests on Sauce• SAUCE=1 mocha -t 90000 -R spec test/ios.js
![Page 39: mobile automation made awesome - Appium: Mobile App ...appium.io/jqueryuk.pdf · Ecosystem & Integrations Project Lead & Architect Unit/Functional Mobile Testing with Appium and Sauce](https://reader031.fdocuments.net/reader031/viewer/2022021511/5ac024f07f8b9ae45b8bd434/html5/thumbnails/39.jpg)
Questions?
http://appium.iohttps://github.com/appium/appium
@AppiumDevs • @jlipps • @saucelabs
![Page 40: mobile automation made awesome - Appium: Mobile App ...appium.io/jqueryuk.pdf · Ecosystem & Integrations Project Lead & Architect Unit/Functional Mobile Testing with Appium and Sauce](https://reader031.fdocuments.net/reader031/viewer/2022021511/5ac024f07f8b9ae45b8bd434/html5/thumbnails/40.jpg)
Thanks!
http://appium.iohttps://github.com/appium/appium
@AppiumDevs • @jlipps • @saucelabs