Mobile developer, music enthusiast, grunge... a really annoying partner!
Mobile testing with Appium
Who am I ?
Software Engineer @ SauceLabs - Emulators & Simulators Team
Fullstack developer, Nodejs enthusiast
- Browsers, Emulators, Simulators & Real devices in the cloud!
More than 300 combinations of browsers/OS
Test mobile & webapps in parallel
Watch videos, screenshots, logs,... of your automated tests
What is Appium ?
Appium is an open source test automation framework for use with native, hybrid and mobile web apps.
It drives iOS, Android, Windows desktop apps and more using the WebDriver protocol
Why Appium ?
- You can write tests with your favorite dev tools using any WebDriver-compatible language
- Detect errors & bugs faster
- Improve release times (Manual vs Automated)
- Run tests in lots of devices (different os versions, architectures, screens, resolutions,...)
- Avoid regressions (a bug that comes back)
- Create apps demos for marketing & clients
- Study performances
How appium works
- You write your tests using one of Appium client libraries
- Your tests
callsthe Webdriver API
- The Webdriver sends the request in form of
JSonvia httprequest to the Appium server.
- The Appium server, under the
hoodinvokes vendor specific mechanisms to execute the test commands
- The client (devices or emulators) responds back to Appium server
- Appium server logs the results in
- Appium joins the JS Foundation
- Added support for Appium to target Apple's new XCUITest framework, which includes support for iOS 10 / Xcode 8.
- Appium team is extremely proud to release the first iteration of our integration with Microsoft's WinAppDriver, a Windows app automation technology designed from the ground up to work with Appium.
- Appium 1.6 also ships with early beta support of an upgrade to Appium's Android support using UIAutomator 2.
- Folks behind You.i Engine have released an Appium driver for automating apps built with their framework
- Android SDK API >= 17
- Mac OS X 10.10 or higher, 10.11.1 recommended
- XCode >= 7.1.1 recommended (Xcode 8 ? brew install
- Apple Developer Tools (iPhone simulator SDK, command line tools)
npm install -g appium
Before testing, make sure you have emulators|simulators available
Let the tests begin!
git clone https://github.com/vrunoa/appium-workshop
The idea is to follow this slides and start creating tests from knowing nothing to run a test on the cloud using a tunnel.
For order of this to happen we are going to follow the exercises under this repo. Check the README inside every exercise folder. And if you have any doubts ask me or cheat by looking at the solution.
The WebDriver client
Capabilities are the way to tell Appium which kind of session we are interested in.
Most common capabilities
|platformName||Which mobile OS platform to use||Android, iOS|
|platformVersion||Mobile OS version||9.3, 4.4.3|
|deviceVersion||The kind of mobile device or emulator to use||iPhone Simulator, iPad Simulator,iPhone Retina 4-inch, Android Emulator...|
|automationName||Which automation engine to use||Appium(default), Selendroid, XCuiTest|
|browserName||Name of mobile web browser to automate. Should be an empty string if automating an app instead||'Safari' for iOS and 'Chrome', 'Chromium', or 'Browser' for Android|
|orientation||(Sim/Emu-only) start in a certain orientation||LANDSCAPE or PORTRAIT|
Starting a session
Opening an url
Getting the page title
Closing current session
What if I want to run the same test on an Android emulator ?
Change the capabilities
Playing with elements
What about native apps testing ?
Use native application capabilities
Android common capabilities
|appActivity||Activity name for the Android activity you want to launch from your package.||.MainActivity, .Settings, .SplashActivity|
|appPackage||Java package of the Android app you want to run||com.example.android.app|
|appWaitActivity||Activity name for the Android activity you want to wait for||.MainActivity|
|avd||Name of avd to launch||Nexus-5-API-19|
|avdArgs||Additional emulator arguments used when launching an avd||-netfast, -http-proxy, -camera-front|
|app||The absolute local path or remote http URL to an .ipa or .apk file, or a .zip containing one of these. Appium will attempt to install this app binary on the appropriate device first||/abs/path/to/my.apk orhttp://myapp.com/app.ipa|
iOS common capabilities
|bundleId||Bundle ID of the app under test. Useful for starting an app on a real device or for using other caps which require the bundle ID during test startup. To run a test on a real device using the bundle ID, you may omit the 'app' capability, but you must provide 'udid'.||io.appium.TestApp|
|udid||Unique device identifier of the connected physical device||1ae203187fc012g|
|locationServicesEnabled||(Sim-only) Force location services to be either on or off. Default is to keep current sim setting.||true or false|
|locationServicesAuthorized||(Sim-only) Set location services to be authorized or not authorized for app via plist, so that location services alert doesn't pop up. Default is to keep current sim setting. Note that if you use this setting you MUST also use the bundleIdcapability to send in your app's bundle ID.||true or false|
|autoAcceptAlerts||Accept all iOS alerts automatically if they pop up. This includes privacy access permission alerts||true or false|
|autoDismissAlerts||Dismiss all iOS alerts automatically if they pop up.||true or false|
Changing contexts to test Hybrid apps
Using cloud devices at SauceLabs
Sauce connect, use a tunnel in the cloud
The future of Appium
- Android 7.0 and ios 10.1 support
- New Appium GUI built on electron
- Considering Windows Phone, Applet watch support
- Appium 2.0 roadmap
Appium, rather than bundling all the separate drivers by default, becomes a driver management interface (in addition to continuing to play the role of automation frontend server). Appium gets a set of CLI tools for users to pick and choose which drivers and versions of drivers they want to use via Appium.
Mobile testing with Appium... the workshop
By Bruno Alassia