Slide 1

Slide 1 text

mobile automation made awesome Jonathan Lipps • Director of Ecosystem & Integrations • Sauce Labs @AppiumDevs • @jlipps • @saucelabs jQueryUK Workshop • Oxford, UK May 16 2014

Slide 2

Slide 2 text

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

Slide 3

Slide 3 text

appium introduction

Slide 4

Slide 4 text

The Dev Cycle of Optimal Happiness [ ]

Slide 5

Slide 5 text

appium is the cross-platform solution for native and hybrid mobile automation

Slide 6

Slide 6 text

Philosophy R1. Test the same app you submit to the marketplace R2. Write your tests in any language, using any framework R3. Use a standard automation specification and API R4. Build a large and thriving open-source community effort

Slide 7

Slide 7 text

No content

Slide 8

Slide 8 text

appium architecture

Slide 9

Slide 9 text

Automation Orchestra Apple Instruments & UIAutomation for iOS Google UiAutomator for Android (4.2.1 up) Selendroid for older Android WebDriver interface

Slide 10

Slide 10 text

appium is an HTTP server that creates and handles WebDriver sessions

Slide 11

Slide 11 text

appium extends the WebDriver protocol with mobile-specific behaviors

Slide 12

Slide 12 text

appium setup

Slide 13

Slide 13 text

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

Slide 14

Slide 14 text

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”

Slide 15

Slide 15 text

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

Slide 16

Slide 16 text

Make an Android Device • android • Check ‘Intel x86 Atom System Image’ - Android (4.4) • Click ‘Install 1 package...’ • Tools > Manage AVDs • New...

Slide 17

Slide 17 text

• AVD Name: workshop • Device: Nexus S • Target: Android 4.4 • CPU: Intel/Atom • Skin: hw controls • Host GPU Create the Image

Slide 18

Slide 18 text

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)

Slide 19

Slide 19 text

Get the workshop code • git clone https://github.com/jlipps/ jqueryuk-workshop-2014.git • cd jqueryuk-workshop-2014

Slide 20

Slide 20 text

Install dependencies • npm install -g appium # no sudo! • npm install -g cordova • npm install -g mocha • npm install .

Slide 21

Slide 21 text

unit tests

Slide 22

Slide 22 text

Run local server • node server.js • # visit http://localhost:8081

Slide 23

Slide 23 text

No content

Slide 24

Slide 24 text

Run QUnit tests • http://localhost:8081/test.html • # moviesearch/www/test.html • # moviesearch/www/test.js

Slide 25

Slide 25 text

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”

Slide 26

Slide 26 text

Get Sauce Connect • https://saucelabs.com/docs/connect • cp ~/Downloads/sc-4.2-osx/bin/sc \ /usr/local/bin

Slide 27

Slide 27 text

Start Sauce Connect • sc -u $SAUCE_USERNAME -k $SAUCE_ACCESS_KEY

Slide 28

Slide 28 text

Run JS unit tests on Sauce Labs • ./test/jsunit.sh • http://saucelabs.com/tests

Slide 29

Slide 29 text

appium test model

Slide 30

Slide 30 text

Start/stop a session

Slide 31

Slide 31 text

Find & Interact with Elements

Slide 32

Slide 32 text

Automate a WebView

Slide 33

Slide 33 text

appium tests

Slide 34

Slide 34 text

Build & run sample apps • ./go_ios.sh • ./go_android.sh

Slide 35

Slide 35 text

Launch Appium • sudo authorize_ios • appium

Slide 36

Slide 36 text

Moment of truth... • mocha -t 90000 -R spec test/ios.js • mocha -t 90000 -R spec test/android.js

Slide 37

Slide 37 text

Upload app to Sauce Storage • ./test/upload.sh • # or use pre-uploaded app url

Slide 38

Slide 38 text

Run Appium tests on Sauce • SAUCE=1 mocha -t 90000 -R spec test/ios.js

Slide 39

Slide 39 text

Questions? http://appium.io https://github.com/appium/appium @AppiumDevs • @jlipps • @saucelabs

Slide 40

Slide 40 text

Thanks! http://appium.io https://github.com/appium/appium @AppiumDevs • @jlipps • @saucelabs