SlideShare a Scribd company logo
1 of 86
Download to read offline
Appium workshop
Syam Sasi
Martin Schneider
Technopark Trivandrum, 18.05.2019
About us
Syam Sasi
Senior Software Engineer @ Carousell
https://about.me/syamsasi
Martin Schneider
Senior Software Engineer @ Carousell
mart.schneider@gmail.com
Code
https://github.com/martinschneider/appium-workshop-2019-05-18
git clone git@github.com:martinschneider/appium-workshop-2019-05-18.git
mvn compile
© Martin Schneider, mart.schneider@gmail.com
Background and history of Appium
A brief (overly simplified) history of UI test automation
1993: QA Partner (Segue Software)
1996: QA Partner → Silk Test
2004: Selenium created at ThoughtWorks (Jason Huggins)
2005: Robot Framework (Pekka Klärck)
2006: Borland acquires Silk Test
2007: WebDriver (Simon Stewart)
2008: Selenium Grid
2008: Cucumber (Aslak Hellesøy)
2009: Selenium + WebDriver = Selenium 2.0
2009: MicroFocus acquires Borland
2009: Silk4J
2011: iOS Auto (Dan Cuellar)
2013: Espresso
2014: Appium 1.0 (Saucelabs)
2017: Silk Webdriver
© Martin Schneider, mart.schneider@gmail.com
The history of Appium
2011: Dan Cuellar creates iOSAuto, a tool for iOS automation written in C#
2012: Dan presents Appium during a Lightning Talk at the 2012 Selenium Conference in London
2012: Dan rewrites appium in Python and open-sources it under the Apache 2 license
2012: Cooperation with Jason Huggins (Selenium co-founder) starts
2013: Saucelabs starts backing Appium
2013: Appium is rewritten using node.js
2013: Android support is added → first truly platform-independent mobile testing framework
2014: Appium 1.0 is released
2016: Drivers for Windows desktop and youi.tv automation are added
2016: Appium is donated to the JS Foundation
The journey continues!
http://appium.io/history.html
https://github.com/appium
http://appium.io/
© Martin Schneider, mart.schneider@gmail.com
Coffee break reading material ;-)
https://www.infoq.com/news/2018/04/cucumber
-bdd-ten-years
https://www.seleniumhq.org/about/history.jsp
http://appium.io/history.html
© Martin Schneider, mart.schneider@gmail.com
Appium philosophy
Appium philosophy
1. You shouldn't have to recompile your app or modify it in any way in order to
automate it.
2. You shouldn't be locked into a specific language or framework to write and
run your tests.
3. A mobile automation framework shouldn't reinvent the wheel when it comes
to automation APIs.
4. A mobile automation framework should be open source, in spirit and
practice as well as in name!
Appium design
Appium design
Appium basics
Appium architecture
Appium client Appium server
JSONWP
● Client-server architecture
● Server is written in node.js
● Clients are available for all major
programming languages
UIAutomator 2
XCUITest
Selenium
WebDriver driver = new FirefoxDriver();
driver.get("http://www.google.com");
WebElement element = driver.findElement(By.name("q"));
element.sendKeys("Appium Meet-up");
element.submit();
...
Appium
AppiumDriver driver = driver = new AppiumDriver(new
URL("http://127.0.0.1:4723/wd/hub"), capabilities);
IOSElement element = driver.findElement(By.name("search"));
element.sendKeys("Appium Meet-up");
element.submit();
...
Selenium and Appium
Appium vs. native frameworks
● Appium is highly portable.
● We can use the same tool to automate Android, iOS, Web (with
Selenium) and Windows Desktop applications → multi-platform test
frameworks.
● Appium is slower than native automation.
● There is an overhead that comes with the client/server architecture.
Appium basics
Our first Appium test:
● /appium-demo/src/test/java/io/github/martinschneider/appium/android/CounterTest01.java
● /appium-demo/src/test/java/io/github/martinschneider/appium/android/CounterTest02.java
Appium capabilities
Appium Capabilities
General Capabilities
automationName - XCUITest or UiAutomator2
platformName - iOS or Android
platformVersion - 7.0, 11.0
deviceName - iPhone6, Samsung Galaxy S8
app - /path/to/apk, app or ipa
fullReset - true or false
newCommandTimeout - in seconds
Appium Desktop
Why Appium Desktop?
● Inspect Android and iOS App UI
● Search for a mobile element
● Record the actions
Appium Desktop Demo
Inspecting Android App
1. Run appium command in command prompt/terminal
2. Open Appium Desktop
3. Click on Appium > New Session Window
4. Enter the following capabilities and save
Note: Pixel is the name of the emulator
{
"platformName":"android",
"deviceName":"Pixel",
"automationName":"UiAutomator2",
"app":"/path/to/apk/file",
"avd","Pixel"
}
Android locator types
Android locator types
● accessibility
● id
● xpath
● class
● uiAutomator
● image
http://appium.io/docs/en/commands/element/find-elements/
https://saucelabs.com/blog/advanced-locator-strategies
Android locator types
● /appium-demo/src/test/java/io/github/martinschneider/appium/android/CounterTest03.java
● /appium-demo/src/test/java/io/github/martinschneider/appium/android/CounterTest04.java
Inspector tools
Appium inspector
{
"platformName" : "android",
"appPackage": "com.thecarousell.Carousell" ,
"appActivity": "com.thecarousell.Carousell.activities.EntryActivity" ,
"appPath": "/Users/martinschneider/carousell.apk",
"deviceName" : "test",
}
Appium inspector
Macaca inspector
● https://macacajs.github.io/app-inspector/
● npm i app-inspector -g
● adb devices
● app-inspector -u YOUR-DEVICE-ID
● http://10.0.1.117:5678
● Does not require Appium or an Appium session
Macaca inspector
● https://macacajs.github.io/app-inspector/
● npm i app-inspector -g
● app-inspector -u YOUR-DEVICE-ID
● http://10.0.1.117:5678/
Waiting strategies
Waiting strategies
● /appium-demo/src/test/java/io/github/martinschneider/appium/android/LoginTest01.java
● /appium-demo/src/test/java/io/github/martinschneider/appium/android/LoginTest02.java
● /appium-demo/src/test/java/io/github/martinschneider/appium/android/LoginTest03.java
● /appium-demo/src/test/java/io/github/martinschneider/appium/android/LoginTest04.java
Static wait
Thread.sleep(3000);
● Fixed duration for every execution
○ either too long (waste of execution time)
○ or too short (test will still fail)
● Remember: Test behave differently
○ on different environments
○ under different network conditions
○ etc.
● Just ugly and wrong! Avoid at all costs!
© Martin Schneider, mart.schneider@gmail.com
Implicit wait
driver.manage().timeouts().implicitlyWait(10,
TimeUnit.SECONDS);
● Will wait up to the specified time for every element.
● Speeds up test execution locally but also slows down overall test execution
because it is a global setting (no ability to fail fast)!
● Better than static waits but still not quite convenient enough….
© Martin Schneider, mart.schneider@gmail.com
WebDriverWait wait = new WebDriverWait(driver, 10);
wait.until(presenceOfElementLocated(goToLogin))
.click();
wait.until(presenceOfElementLocated(username))
.sendKeys(username);
● Waits until a condition is met.
● This isn’t limited to visibility.
● We can implement custom conditions.
● We can use different timeouts for different use-cases!
Explicit wait
© Martin Schneider, mart.schneider@gmail.com
Swipe and scroll
The X Y Coordinates
The Touch Action Class
● /appium-demo/src/test/java/io/github/martinschneider/appium/android/swipe/SwipeTest.java
1. Touch Action
*press*release*moveTo*tap*wait*longPress.cancel.perform
TouchAction().press(el1).moveTo(el2).release();
2. Multi Touch
action1 = TouchAction().tap(el1);
action2 = TouchAction().tap(el2);
MultiAction().add(action1).add(action2).perform();
Page object model
Page objects
© Martin Schneider, mart.schneider@gmail.com
● De-facto standard design pattern in UI test automation.
● A page object is an object-oriented class that serves as an interface to a
page/screen of your AUT.
● Goals: enhance maintenance, avoid code duplication
● Ideally one page object per page/screen/dialog/component.
● Tests don’t care about the layout and locators of your app. They just
interact with page objects.
● We can use mechanisms like Dependency Injection to simplify the use of
page objects.
Theory is boring...
● /appium-demo/src/test/java/io/github/martinschneider/appium/android/LoginTest05.java
● /appium-demo/src/test/java/io/github/martinschneider/appium/android/LoginTest06.java
● /appium-demo/src/test/java/io/github/martinschneider/appium/android/LoginTest07.java
How to design a test framework?
Some thoughts
How to design a test framework?
© Martin Schneider, mart.schneider@gmail.com
● Don’t re-invent the wheel but combine existing tools in a way that best fit
your use-case.
● Always keep re-usability, adaptability, extensibility and scalability in mind.
● A quick (and “dirty”) PoC is a start but what’s your use-case in 6 months / 1
year / 5 years… Is your design ready for the change?
● → Have a vision and lay the foundation accordingly.
● Good design now = less refactoring later.
● Test automation requires software engineers (test engineer = engineer).
● Apply the same (or better) practices you have for building the solutions you
sell to your customers, always lead by example (quality!).
● Powerful under the hood but super-easy to use.
● A framework is cool but don’t forget the culture in which it is used.
https://www.linkedin.com/in/martin-schneider
How to design a test framework?
© Martin Schneider, mart.schneider@gmail.com
Core framework
Business model
Page objects and DTOs
Tests Testdata
Cloud
integration
3rd party
integrations
Test helper
API layer
EXAMPLE
Robot
IOS automation
Locator Strategy for iOS
Accessibility ID
driver.findElement(MobileBy.AccessibilityID ("foo"));
iOS NS Predicates
driver.findElementByIosNsPredicate (tableViews()[1].cells().firstWithPr
edicate("label == 'Olivia' " ));
iOS Class Chain
driver.findElement(MobileBy.iOSClassChain("**/XCUIElementTypeCell[`nam
e BEGINSWITH " C"`]/XCUIElementTypeButton[10]" ));
● /appium-demo/src/test/java/io/github/martinschneider/appium/ios/IOSTest.java
Real device vs. simulators/emulators
Appium On Real Devices - Android
© Martin Schneider, mart.schneider@gmail.com
1. Enable USB Debugging
2. Connect the device using usb
3. Note down the udid
4. Device is detected when run the adb devices command
https://developer.android.com/studio/debug/dev-options
Appium On Real Devices - iOS
© Martin Schneider, mart.schneider@gmail.com
1. cd
/usr/local/lib/node_modules/appium/node_modules/appium-
xcuitest-driver/WebDriverAgent
2. mkdir -p Resources/WebDriverAgent.bundle
3. /bin/bash ./Scripts/bootstrap.sh -d
4. brew install carthage
5. brew install libimobiledevice --HEAD
6. npm install -g ios-deploy
7. UI Automation enabled on iOS device
8. Xcode has proper code sign enabled
http://appium.io/docs/en/drivers/ios-xcuitest-real-devices/
Which one I need?
© Martin Schneider, mart.schneider@gmail.com
Cloud automation
Next question: How can we scale this?
© Martin Schneider, mart.schneider@gmail.com
Next question: How can we scale this?
© Martin Schneider, mart.schneider@gmail.com
On premise vs. cloud
● Full control
○ Number of devices
○ Types of devices
○ Software libraries
○ ...
● No maintenance required
● Fixed costs
● Support
● Maintenance
○ replace devices
○ fix issues
○ infrastructure
○ ...
● Less flexibility
○ Available devices
○ Software update cycle? (Appium,
Java)
© Martin Schneider, mart.schneider@gmail.com
Two approaches towards cloud testing
#1: Client-side execution
Step 1: Upload your APP to the cloud
Step 2: Create a WebDriver instance
capabilities.setCapability("app", appUrl);
new AppiumDriver("http://cloud.com/wd/hub", capabilities);
Step 3: Execute your tests as before
For example, Browserstack, Saucelabs, pCloudy...
© Martin Schneider, mart.schneider@gmail.com
Two approaches towards cloud testing
#2: Server-side execution
Step 1: Upload your APP to the cloud
Step 2: Package and upload your tests to the cloud
Step 3: Tests get executed on the cloud
For example, AWS Devicefarm (public cloud)
© Martin Schneider, mart.schneider@gmail.com
Client- vs. server-side execution
● Easier migration
○ Execution flow remains the same
○ Reporting and CI remain the same
● More control
○ Software updates on the client side
○ easier to use a mixed/hybrid mode
(=use different cloud providers or
local + cloud)
● Performance (maybe)
● Network latency ● Trust and compliance
● Integration overhead
○ Test results and reporting
○ Network challenges
© Martin Schneider, mart.schneider@gmail.com
Factors to consider
What’s your use-case?
● Devices
○ specific models, manufacturers, OS versions
● Parallelisation
○ How to distribute n tests across m devices efficiently (each test runs once)?
○ How to run n tests on m devices in parallel (each test runs m times)?
● Time constraints, execution speed, waiting times
○ run tests once a day (“nightly tests”) → not time-critical
○ run tests multiple times a day to verify changes → highly time-critical
● Client- vs. server execution mode
● API support
● Cost and pricing models
● Future use-cases
© Martin Schneider, mart.schneider@gmail.com
Device models
● In the US Apple and Samsung cover 81% of the market (UK 87%,
Singapore 82%, Australia 89% etc.)
● What about Xiaomi, Oppo, Vivo, Lyf...?
© Martin Schneider, mart.schneider@gmail.com
Device market share in India
© Martin Schneider, mart.schneider@gmail.com
Source: https://deviceatlas.com/
Device models
● Huawei (13,3%)
surpassed Apple
(11,9%) in market
share in Q2/2018
● Q1/2019: 19% global
market share
© Martin Schneider, mart.schneider@gmail.com
Device models
Market specifics
● India: 20% Xiaomi (#3) = 2/3 are neither Apple nor Samsung
● Myanmar (2018): 19% Oppo (#2), 18% Vivo (#3), 13% Xiaomi (#4), 11%
Huawei (#5) = 70% not Apple and Samsung
● Pakistan: 11% QMobile (#2)
● Bangladesh: 14% Symphony (#2)
Sources:
https://www.gartner.com/en/newsroom/press-releases/2018-08-28-gartner-says-huawei-secured-no-2-
worldwide-smartphone-vendor-spot-surpassing-apple-in-second-quarter, https://deviceatlas.com/
© Martin Schneider, mart.schneider@gmail.com
Device models
● AWS Device Farm doesn't have any Huawei, Xiaomi, Oppo or Vivo models
(in their public cloud)
● Browserstack only supports Samsung, Google and Apple phones (and one
OnePlus model)
Sources:
https://www.gartner.com/en/newsroom/press-releases/2018-08-28-gartner-says-huawei-secured-no-2-
worldwide-smartphone-vendor-spot-surpassing-apple-in-second-quarter, https://deviceatlas.com,
https://www.browserstack.com/list-of-browsers-and-platforms/app_automate, http://awsdevicefarm.info
© Martin Schneider, mart.schneider@gmail.com
Demos
We will run the same login test on AWS Devicefarm, Browserstack and locally.
AWS Devicefarm
● package the test configuration into a test spec and upload to AWS
● upload the APK file to AWS
● package our tests (+framework) and upload to AWS
● select an available device (using device filters)
● execute the tests and process the results
Browserstack
● upload the APK file to Browserstack
● configure the execution (this includes the device selection) using Capabilities
● execute the tests and process the results
www.justtestlah.qa
https://medium.com/@mart.schneider/mobile-test-automation-using-aws-device-farm-6bcf825fa27d
© Martin Schneider, mart.schneider@gmail.com
Appium tips and tricks
#1 Network Conditions
● Toggle Airplane - driver.toggleAirplaneMode ();
● Toggle Data - driver.toggleData();
● Toggle Wifi - driver.toggleWifi();
#2 Android Emulator commands
● Send SMS -
driver.sendSMS("555-123-4567", "Hey?");
● GSM Call -
driver.makeGsmCall("5551234567", GsmCallActions.CALL);
● GSM Signal -
driver.setGsmSignalStrength(GsmSignalStrength.GOOD);
● Geo Location -
driver.setLocation(new Location(49, 123, 10));
#3 Dealing With An Element When Visibility Is False
// first, find our element
WebElement ref = wait
.until(ExpectedConditions .presenceOfElementLocated (element));
// get the location and dimensions of the reference element, and find its
center point
Rectangle rect = ref.getRect();
int refElMidX = rect.getX() + rect.getWidth() / 2;
int refElMidY = rect.getY() + rect.getHeight() / 2;
// set the center point of our desired element; w
int desiredElMidX = refElMidX;
int desiredElMidY = refElMidY - rect.getHeight();
// perform the TouchAction that will tap the desired point
TouchAction action = new TouchAction<>(driver);
action.press(PointOption.point(desiredElMidX, desiredElMidY ));
action.waitAction(WaitOptions.waitOptions(Duration.ofMillis(500)));
action.release();
action.perform();
#4 Speeding Up Your Tests
● Deeplinks
driver.get("theapp://login/" + AUTH_USER + "/" + AUTH_PASS);
● OptionalIntentArguments
caps.setCapability("optionalInentArguments", String.format("-e "username"
"%s" -e "password" "%s"", AUTH_USER, AUTH_PASS));
#5 Fine Tuning The Capabilities - Cross Platform
● Cross Platform
○ noReset
○ fullReset
○ isHeadless
#6 Fine Tuning The Capabilities - Android
● Android
○ disableAndroidWatchers
○ autoGrantPermissions
○ skipUnlock
○ ignoreUnimportantViews
#7 Fine Tuning The Capabilities - iOS
● iOS
○ usePrebuildWDA and derivedDataPath
○ useJSONSource
○ iosInstallPause
○ maxTypingFrequency
○ realDeviceScreenShotter
○ simpleIsVisibleCheck
#8 Testing App Upgrades
Android
driver.installApp("/path/to/apk" );
driver.startActivity(activity);
iOS
HashMap<String, String> bundleArgs = new HashMap<>();
bundleArgs.put("bundleId", BUNDLE_ID);
driver.executeScript("mobile: terminateApp" , bundleArgs);
HashMap<String, String> installArgs = new HashMap<>();
installArgs.put("app", appUpgradeVersion );
driver.executeScript("mobile: installApp" , installArgs);
driver.executeScript("mobile: launchApp" , bundleArgs);
#9 Switching Between Apps
● Android
driver.startActivity(settingsAppPackageName , settingsAppActivityName );
● iOS
// launch the photos app (with the special bundle id seen below)
HashMap<String, Object> args = new HashMap<>();
args.put("bundleId", "com.apple.mobileslideshow" );
driver.executeScript("mobile: launchApp" , args);
// re-activate that AUT (in this case The App)
args.put("bundleId", "io.cloudgrey.the-app" );
driver.executeScript("mobile: activateApp" , args);
#10 Testing The Push Notifications
1. Kill The App driver.terminateApp(bundleId or pkg );
2. Open The Notification Pannel
a. Android driver.openNotifications ();
b. iOS Swipe From Top Down to show the notification centre
3. Wait For Push Notification Content
4. Close The Panel and Relaunch The App
driver.activateApp(bundleId or pkg );
#11 Automating Custom iOS Alerts
wait.until(ExpectedConditions .alertIsPresent ());
HashMap<String, String> args = new HashMap<>();
args.put("action", "getButtons");
List<String> buttons = (List<String>)driver.executeScript("mobile:
alert", args);
// find the text of the button which isn't 'OK' or 'Cancel'
String buttonLabel = null;
for (String button : buttons) {
if (button.equals("OK") || button.equals("Cancel")) {
continue;}
buttonLabel = button;}
if (buttonLabel == null) {
throw new Error("Did not get a third alert button as we were
expecting");
}
args.put("action", "accept");
args.put("buttonLabel", buttonLabel);
driver.executeScript("mobile: alert" , args);
#12 Automating A Picker Wheel On iOS
1. Using SendKeys
pickerWheelElement.sendKeys("March");
2. Picker Wheel Value
HashMap<String, Object> params = new HashMap<>();
params.put("order", "next");
params.put("offset", 0.15);
params.put("element", ((RemoteWebElement)
pickerWheelElement).getId());
driver.executeScript("mobile:
selectPickerWheelValue", params);
#13 Video Recording The Test Execution
IOSStartScreenRecordingOptions
iOSStartScreenRecordingOptions =new
IOSStartScreenRecordingOptions().withVideoQuality(IOSStartSc
reenRecordingOptions.VideoQuality.HIGH).withTimeLimit(Durati
on.ofSeconds(SCREEN_RECORD_DURATION));
driver.startRecordingScreen(iOSStartScreenRecordingOptions);
record = ((IOSDriver) driver).stopRecordingScreen();
byte[] decode = Base64.getDecoder().decode(record);
File videoFile =new File(new
StringBuilder().append(“MyVideo.Mp4”).toString());
FileUtils.writeByteArrayToFile(videoFile, decode);
#14 Parallel And Distributed Testing
● Running multiple Appium servers, and sending one session to each server
● Running one Appium server, and sending multiple sessions to it
● Running one or more Appium servers behind the Selenium Grid Hub, and
sending all sessions to the Grid Hub
● Leveraging a cloud provider (which itself is running many Appium servers,
most likely behind some single gateway)
#15 Desktop App Automation
● Appium for Mac - https://github.com/appium/appium-for-mac
● WinAppDriver - https://github.com/Microsoft/WinAppDriver
Quiz Time
Go to https://kahoot.it
References
● http://appium.io
● https://appiumpro.com/editions
● https://github.com/SrinivasanTarget/awesome-appium
● https://github.com/appium/appium/tree/master/docs/en/advanced-concepts
● https://github.com/singapore-appium-meetup/meetups
● https://www.justtestlah.qa

More Related Content

What's hot

Mobile Test Automation - Appium
Mobile Test Automation - AppiumMobile Test Automation - Appium
Mobile Test Automation - AppiumMaria Machlowska
 
Android & iOS Automation Using Appium
Android & iOS Automation Using AppiumAndroid & iOS Automation Using Appium
Android & iOS Automation Using AppiumMindfire Solutions
 
Testing Native iOS Apps with Appium
Testing Native iOS Apps with AppiumTesting Native iOS Apps with Appium
Testing Native iOS Apps with AppiumSauce Labs
 
What's New With Appium? From 1.0 to Now
What's New With Appium? From 1.0 to NowWhat's New With Appium? From 1.0 to Now
What's New With Appium? From 1.0 to NowSauce Labs
 
Using Selenium to Test Native Apps (Wait, you can do that?)
Using Selenium to Test Native Apps (Wait, you can do that?)Using Selenium to Test Native Apps (Wait, you can do that?)
Using Selenium to Test Native Apps (Wait, you can do that?)Sauce Labs
 
Appium@Work at PAYBACK
Appium@Work at PAYBACKAppium@Work at PAYBACK
Appium@Work at PAYBACKMarcel Gehlen
 
Parallel Test Runs with Appium on Real Mobile Devices – Hands-on Webinar
Parallel Test Runs with Appium on Real Mobile Devices – Hands-on WebinarParallel Test Runs with Appium on Real Mobile Devices – Hands-on Webinar
Parallel Test Runs with Appium on Real Mobile Devices – Hands-on WebinarBitbar
 
Appium Interview Questions and Answers | Edureka
Appium Interview Questions and Answers | EdurekaAppium Interview Questions and Answers | Edureka
Appium Interview Questions and Answers | EdurekaEdureka!
 
Mobile Automation with Appium
Mobile Automation with AppiumMobile Automation with Appium
Mobile Automation with AppiumManoj Kumar Kumar
 
Appium: Mobile Automation Made Awesome
Appium: Mobile Automation Made AwesomeAppium: Mobile Automation Made Awesome
Appium: Mobile Automation Made AwesomeNetcetera
 
Vietnam qa meetup
Vietnam qa meetupVietnam qa meetup
Vietnam qa meetupSyam Sasi
 
Appium - test automation for mobile apps
Appium - test automation for mobile appsAppium - test automation for mobile apps
Appium - test automation for mobile appsAleksejs Trescalins
 
Cross Platform Appium Tests: How To
Cross Platform Appium Tests: How ToCross Platform Appium Tests: How To
Cross Platform Appium Tests: How ToGlobalLogic Ukraine
 
Automation Testing With Appium
Automation Testing With AppiumAutomation Testing With Appium
Automation Testing With AppiumKnoldus Inc.
 
How React Native, Appium and me made each other shine @ContinuousDeliveryAmst...
How React Native, Appium and me made each other shine @ContinuousDeliveryAmst...How React Native, Appium and me made each other shine @ContinuousDeliveryAmst...
How React Native, Appium and me made each other shine @ContinuousDeliveryAmst...Wim Selles
 
Introduction To Appium With Robotframework
Introduction To Appium With RobotframeworkIntroduction To Appium With Robotframework
Introduction To Appium With RobotframeworkSyam Sasi
 

What's hot (20)

Mobile Test Automation - Appium
Mobile Test Automation - AppiumMobile Test Automation - Appium
Mobile Test Automation - Appium
 
Android & iOS Automation Using Appium
Android & iOS Automation Using AppiumAndroid & iOS Automation Using Appium
Android & iOS Automation Using Appium
 
Testing Native iOS Apps with Appium
Testing Native iOS Apps with AppiumTesting Native iOS Apps with Appium
Testing Native iOS Apps with Appium
 
Appium
AppiumAppium
Appium
 
What's New With Appium? From 1.0 to Now
What's New With Appium? From 1.0 to NowWhat's New With Appium? From 1.0 to Now
What's New With Appium? From 1.0 to Now
 
Using Selenium to Test Native Apps (Wait, you can do that?)
Using Selenium to Test Native Apps (Wait, you can do that?)Using Selenium to Test Native Apps (Wait, you can do that?)
Using Selenium to Test Native Apps (Wait, you can do that?)
 
Appium@Work at PAYBACK
Appium@Work at PAYBACKAppium@Work at PAYBACK
Appium@Work at PAYBACK
 
Parallel Test Runs with Appium on Real Mobile Devices – Hands-on Webinar
Parallel Test Runs with Appium on Real Mobile Devices – Hands-on WebinarParallel Test Runs with Appium on Real Mobile Devices – Hands-on Webinar
Parallel Test Runs with Appium on Real Mobile Devices – Hands-on Webinar
 
Appium ppt
Appium pptAppium ppt
Appium ppt
 
Appium Interview Questions and Answers | Edureka
Appium Interview Questions and Answers | EdurekaAppium Interview Questions and Answers | Edureka
Appium Interview Questions and Answers | Edureka
 
Mobile Automation with Appium
Mobile Automation with AppiumMobile Automation with Appium
Mobile Automation with Appium
 
Appium: Mobile Automation Made Awesome
Appium: Mobile Automation Made AwesomeAppium: Mobile Automation Made Awesome
Appium: Mobile Automation Made Awesome
 
Vietnam qa meetup
Vietnam qa meetupVietnam qa meetup
Vietnam qa meetup
 
Automated UI Testing Frameworks
Automated UI Testing FrameworksAutomated UI Testing Frameworks
Automated UI Testing Frameworks
 
Appium - test automation for mobile apps
Appium - test automation for mobile appsAppium - test automation for mobile apps
Appium - test automation for mobile apps
 
Cross Platform Appium Tests: How To
Cross Platform Appium Tests: How ToCross Platform Appium Tests: How To
Cross Platform Appium Tests: How To
 
Appium
AppiumAppium
Appium
 
Automation Testing With Appium
Automation Testing With AppiumAutomation Testing With Appium
Automation Testing With Appium
 
How React Native, Appium and me made each other shine @ContinuousDeliveryAmst...
How React Native, Appium and me made each other shine @ContinuousDeliveryAmst...How React Native, Appium and me made each other shine @ContinuousDeliveryAmst...
How React Native, Appium and me made each other shine @ContinuousDeliveryAmst...
 
Introduction To Appium With Robotframework
Introduction To Appium With RobotframeworkIntroduction To Appium With Robotframework
Introduction To Appium With Robotframework
 

Similar to Appium workshop technopark trivandrum

Dive into Angular, part 5: Experience
Dive into Angular, part 5: ExperienceDive into Angular, part 5: Experience
Dive into Angular, part 5: ExperienceOleksii Prohonnyi
 
Front End Development for Back End Developers - vJUG24 2017
Front End Development for Back End Developers - vJUG24 2017Front End Development for Back End Developers - vJUG24 2017
Front End Development for Back End Developers - vJUG24 2017Matt Raible
 
Building And Executing Test Cases with Appium and Various Test Frameworks.pdf
Building And Executing Test Cases with Appium and Various Test Frameworks.pdfBuilding And Executing Test Cases with Appium and Various Test Frameworks.pdf
Building And Executing Test Cases with Appium and Various Test Frameworks.pdfpCloudy
 
Good practices for debugging Selenium and Appium tests
Good practices for debugging Selenium and Appium testsGood practices for debugging Selenium and Appium tests
Good practices for debugging Selenium and Appium testsAbhijeet Vaikar
 
Java Test Automation for REST, Web and Mobile
Java Test Automation for REST, Web and MobileJava Test Automation for REST, Web and Mobile
Java Test Automation for REST, Web and MobileElias Nogueira
 
Google App Engine for Java
Google App Engine for JavaGoogle App Engine for Java
Google App Engine for JavaLars Vogel
 
Тестирование мобильных приложений используя облачные сервисы. TestDroid, Test...
Тестирование мобильных приложений используя облачные сервисы. TestDroid, Test...Тестирование мобильных приложений используя облачные сервисы. TestDroid, Test...
Тестирование мобильных приложений используя облачные сервисы. TestDroid, Test...COMAQA.BY
 
Microservices for the Masses with Spring Boot, JHipster, and OAuth - Jforum S...
Microservices for the Masses with Spring Boot, JHipster, and OAuth - Jforum S...Microservices for the Masses with Spring Boot, JHipster, and OAuth - Jforum S...
Microservices for the Masses with Spring Boot, JHipster, and OAuth - Jforum S...Matt Raible
 
Mobile automation using selenium cucumber & appium
Mobile automation using selenium cucumber & appiumMobile automation using selenium cucumber & appium
Mobile automation using selenium cucumber & appiumSelenium Cucumber
 
How to kill test flake in appium
How to kill test flake in appiumHow to kill test flake in appium
How to kill test flake in appiumGaurav Singh
 
Web Development in Django
Web Development in DjangoWeb Development in Django
Web Development in DjangoLakshman Prasad
 
Unit testing for ext js apps using sencha test - Walkingtree Technologies
Unit testing for ext js apps using sencha test - Walkingtree TechnologiesUnit testing for ext js apps using sencha test - Walkingtree Technologies
Unit testing for ext js apps using sencha test - Walkingtree TechnologiesWalking Tree Technologies
 
API Services: Building State-of-the-Art APIs
API Services: Building State-of-the-Art APIsAPI Services: Building State-of-the-Art APIs
API Services: Building State-of-the-Art APIsApigee | Google Cloud
 
Priyanka Singh_testing_resume
Priyanka Singh_testing_resumePriyanka Singh_testing_resume
Priyanka Singh_testing_resumePriyanka Singh
 

Similar to Appium workshop technopark trivandrum (20)

Dive into Angular, part 5: Experience
Dive into Angular, part 5: ExperienceDive into Angular, part 5: Experience
Dive into Angular, part 5: Experience
 
Front End Development for Back End Developers - vJUG24 2017
Front End Development for Back End Developers - vJUG24 2017Front End Development for Back End Developers - vJUG24 2017
Front End Development for Back End Developers - vJUG24 2017
 
Building And Executing Test Cases with Appium and Various Test Frameworks.pdf
Building And Executing Test Cases with Appium and Various Test Frameworks.pdfBuilding And Executing Test Cases with Appium and Various Test Frameworks.pdf
Building And Executing Test Cases with Appium and Various Test Frameworks.pdf
 
Good practices for debugging Selenium and Appium tests
Good practices for debugging Selenium and Appium testsGood practices for debugging Selenium and Appium tests
Good practices for debugging Selenium and Appium tests
 
Java Test Automation for REST, Web and Mobile
Java Test Automation for REST, Web and MobileJava Test Automation for REST, Web and Mobile
Java Test Automation for REST, Web and Mobile
 
Google App Engine for Java
Google App Engine for JavaGoogle App Engine for Java
Google App Engine for Java
 
Тестирование мобильных приложений используя облачные сервисы. TestDroid, Test...
Тестирование мобильных приложений используя облачные сервисы. TestDroid, Test...Тестирование мобильных приложений используя облачные сервисы. TestDroid, Test...
Тестирование мобильных приложений используя облачные сервисы. TestDroid, Test...
 
Microservices for the Masses with Spring Boot, JHipster, and OAuth - Jforum S...
Microservices for the Masses with Spring Boot, JHipster, and OAuth - Jforum S...Microservices for the Masses with Spring Boot, JHipster, and OAuth - Jforum S...
Microservices for the Masses with Spring Boot, JHipster, and OAuth - Jforum S...
 
An Overview of Angular 4
An Overview of Angular 4 An Overview of Angular 4
An Overview of Angular 4
 
Spring Boot
Spring BootSpring Boot
Spring Boot
 
Appium testing api
Appium testing apiAppium testing api
Appium testing api
 
Ashish Baraiya
Ashish BaraiyaAshish Baraiya
Ashish Baraiya
 
React django
React djangoReact django
React django
 
Sst hackathon express
Sst hackathon expressSst hackathon express
Sst hackathon express
 
Mobile automation using selenium cucumber & appium
Mobile automation using selenium cucumber & appiumMobile automation using selenium cucumber & appium
Mobile automation using selenium cucumber & appium
 
How to kill test flake in appium
How to kill test flake in appiumHow to kill test flake in appium
How to kill test flake in appium
 
Web Development in Django
Web Development in DjangoWeb Development in Django
Web Development in Django
 
Unit testing for ext js apps using sencha test - Walkingtree Technologies
Unit testing for ext js apps using sencha test - Walkingtree TechnologiesUnit testing for ext js apps using sencha test - Walkingtree Technologies
Unit testing for ext js apps using sencha test - Walkingtree Technologies
 
API Services: Building State-of-the-Art APIs
API Services: Building State-of-the-Art APIsAPI Services: Building State-of-the-Art APIs
API Services: Building State-of-the-Art APIs
 
Priyanka Singh_testing_resume
Priyanka Singh_testing_resumePriyanka Singh_testing_resume
Priyanka Singh_testing_resume
 

Recently uploaded

Software and Systems Engineering Standards: Verification and Validation of Sy...
Software and Systems Engineering Standards: Verification and Validation of Sy...Software and Systems Engineering Standards: Verification and Validation of Sy...
Software and Systems Engineering Standards: Verification and Validation of Sy...VICTOR MAESTRE RAMIREZ
 
8251 universal synchronous asynchronous receiver transmitter
8251 universal synchronous asynchronous receiver transmitter8251 universal synchronous asynchronous receiver transmitter
8251 universal synchronous asynchronous receiver transmitterShivangiSharma879191
 
Concrete Mix Design - IS 10262-2019 - .pptx
Concrete Mix Design - IS 10262-2019 - .pptxConcrete Mix Design - IS 10262-2019 - .pptx
Concrete Mix Design - IS 10262-2019 - .pptxKartikeyaDwivedi3
 
Sachpazis Costas: Geotechnical Engineering: A student's Perspective Introduction
Sachpazis Costas: Geotechnical Engineering: A student's Perspective IntroductionSachpazis Costas: Geotechnical Engineering: A student's Perspective Introduction
Sachpazis Costas: Geotechnical Engineering: A student's Perspective IntroductionDr.Costas Sachpazis
 
Gfe Mayur Vihar Call Girls Service WhatsApp -> 9999965857 Available 24x7 ^ De...
Gfe Mayur Vihar Call Girls Service WhatsApp -> 9999965857 Available 24x7 ^ De...Gfe Mayur Vihar Call Girls Service WhatsApp -> 9999965857 Available 24x7 ^ De...
Gfe Mayur Vihar Call Girls Service WhatsApp -> 9999965857 Available 24x7 ^ De...srsj9000
 
Correctly Loading Incremental Data at Scale
Correctly Loading Incremental Data at ScaleCorrectly Loading Incremental Data at Scale
Correctly Loading Incremental Data at ScaleAlluxio, Inc.
 
Arduino_CSE ece ppt for working and principal of arduino.ppt
Arduino_CSE ece ppt for working and principal of arduino.pptArduino_CSE ece ppt for working and principal of arduino.ppt
Arduino_CSE ece ppt for working and principal of arduino.pptSAURABHKUMAR892774
 
Introduction-To-Agricultural-Surveillance-Rover.pptx
Introduction-To-Agricultural-Surveillance-Rover.pptxIntroduction-To-Agricultural-Surveillance-Rover.pptx
Introduction-To-Agricultural-Surveillance-Rover.pptxk795866
 
INFLUENCE OF NANOSILICA ON THE PROPERTIES OF CONCRETE
INFLUENCE OF NANOSILICA ON THE PROPERTIES OF CONCRETEINFLUENCE OF NANOSILICA ON THE PROPERTIES OF CONCRETE
INFLUENCE OF NANOSILICA ON THE PROPERTIES OF CONCRETEroselinkalist12
 
CCS355 Neural Network & Deep Learning UNIT III notes and Question bank .pdf
CCS355 Neural Network & Deep Learning UNIT III notes and Question bank .pdfCCS355 Neural Network & Deep Learning UNIT III notes and Question bank .pdf
CCS355 Neural Network & Deep Learning UNIT III notes and Question bank .pdfAsst.prof M.Gokilavani
 
An introduction to Semiconductor and its types.pptx
An introduction to Semiconductor and its types.pptxAn introduction to Semiconductor and its types.pptx
An introduction to Semiconductor and its types.pptxPurva Nikam
 
Decoding Kotlin - Your guide to solving the mysterious in Kotlin.pptx
Decoding Kotlin - Your guide to solving the mysterious in Kotlin.pptxDecoding Kotlin - Your guide to solving the mysterious in Kotlin.pptx
Decoding Kotlin - Your guide to solving the mysterious in Kotlin.pptxJoão Esperancinha
 
complete construction, environmental and economics information of biomass com...
complete construction, environmental and economics information of biomass com...complete construction, environmental and economics information of biomass com...
complete construction, environmental and economics information of biomass com...asadnawaz62
 
What are the advantages and disadvantages of membrane structures.pptx
What are the advantages and disadvantages of membrane structures.pptxWhat are the advantages and disadvantages of membrane structures.pptx
What are the advantages and disadvantages of membrane structures.pptxwendy cai
 
Biology for Computer Engineers Course Handout.pptx
Biology for Computer Engineers Course Handout.pptxBiology for Computer Engineers Course Handout.pptx
Biology for Computer Engineers Course Handout.pptxDeepakSakkari2
 
An experimental study in using natural admixture as an alternative for chemic...
An experimental study in using natural admixture as an alternative for chemic...An experimental study in using natural admixture as an alternative for chemic...
An experimental study in using natural admixture as an alternative for chemic...Chandu841456
 
UNIT III ANALOG ELECTRONICS (BASIC ELECTRONICS)
UNIT III ANALOG ELECTRONICS (BASIC ELECTRONICS)UNIT III ANALOG ELECTRONICS (BASIC ELECTRONICS)
UNIT III ANALOG ELECTRONICS (BASIC ELECTRONICS)Dr SOUNDIRARAJ N
 
Oxy acetylene welding presentation note.
Oxy acetylene welding presentation note.Oxy acetylene welding presentation note.
Oxy acetylene welding presentation note.eptoze12
 

Recently uploaded (20)

Software and Systems Engineering Standards: Verification and Validation of Sy...
Software and Systems Engineering Standards: Verification and Validation of Sy...Software and Systems Engineering Standards: Verification and Validation of Sy...
Software and Systems Engineering Standards: Verification and Validation of Sy...
 
8251 universal synchronous asynchronous receiver transmitter
8251 universal synchronous asynchronous receiver transmitter8251 universal synchronous asynchronous receiver transmitter
8251 universal synchronous asynchronous receiver transmitter
 
young call girls in Green Park🔝 9953056974 🔝 escort Service
young call girls in Green Park🔝 9953056974 🔝 escort Serviceyoung call girls in Green Park🔝 9953056974 🔝 escort Service
young call girls in Green Park🔝 9953056974 🔝 escort Service
 
Concrete Mix Design - IS 10262-2019 - .pptx
Concrete Mix Design - IS 10262-2019 - .pptxConcrete Mix Design - IS 10262-2019 - .pptx
Concrete Mix Design - IS 10262-2019 - .pptx
 
Sachpazis Costas: Geotechnical Engineering: A student's Perspective Introduction
Sachpazis Costas: Geotechnical Engineering: A student's Perspective IntroductionSachpazis Costas: Geotechnical Engineering: A student's Perspective Introduction
Sachpazis Costas: Geotechnical Engineering: A student's Perspective Introduction
 
Gfe Mayur Vihar Call Girls Service WhatsApp -> 9999965857 Available 24x7 ^ De...
Gfe Mayur Vihar Call Girls Service WhatsApp -> 9999965857 Available 24x7 ^ De...Gfe Mayur Vihar Call Girls Service WhatsApp -> 9999965857 Available 24x7 ^ De...
Gfe Mayur Vihar Call Girls Service WhatsApp -> 9999965857 Available 24x7 ^ De...
 
Correctly Loading Incremental Data at Scale
Correctly Loading Incremental Data at ScaleCorrectly Loading Incremental Data at Scale
Correctly Loading Incremental Data at Scale
 
Arduino_CSE ece ppt for working and principal of arduino.ppt
Arduino_CSE ece ppt for working and principal of arduino.pptArduino_CSE ece ppt for working and principal of arduino.ppt
Arduino_CSE ece ppt for working and principal of arduino.ppt
 
Introduction-To-Agricultural-Surveillance-Rover.pptx
Introduction-To-Agricultural-Surveillance-Rover.pptxIntroduction-To-Agricultural-Surveillance-Rover.pptx
Introduction-To-Agricultural-Surveillance-Rover.pptx
 
INFLUENCE OF NANOSILICA ON THE PROPERTIES OF CONCRETE
INFLUENCE OF NANOSILICA ON THE PROPERTIES OF CONCRETEINFLUENCE OF NANOSILICA ON THE PROPERTIES OF CONCRETE
INFLUENCE OF NANOSILICA ON THE PROPERTIES OF CONCRETE
 
CCS355 Neural Network & Deep Learning UNIT III notes and Question bank .pdf
CCS355 Neural Network & Deep Learning UNIT III notes and Question bank .pdfCCS355 Neural Network & Deep Learning UNIT III notes and Question bank .pdf
CCS355 Neural Network & Deep Learning UNIT III notes and Question bank .pdf
 
An introduction to Semiconductor and its types.pptx
An introduction to Semiconductor and its types.pptxAn introduction to Semiconductor and its types.pptx
An introduction to Semiconductor and its types.pptx
 
Decoding Kotlin - Your guide to solving the mysterious in Kotlin.pptx
Decoding Kotlin - Your guide to solving the mysterious in Kotlin.pptxDecoding Kotlin - Your guide to solving the mysterious in Kotlin.pptx
Decoding Kotlin - Your guide to solving the mysterious in Kotlin.pptx
 
complete construction, environmental and economics information of biomass com...
complete construction, environmental and economics information of biomass com...complete construction, environmental and economics information of biomass com...
complete construction, environmental and economics information of biomass com...
 
What are the advantages and disadvantages of membrane structures.pptx
What are the advantages and disadvantages of membrane structures.pptxWhat are the advantages and disadvantages of membrane structures.pptx
What are the advantages and disadvantages of membrane structures.pptx
 
Biology for Computer Engineers Course Handout.pptx
Biology for Computer Engineers Course Handout.pptxBiology for Computer Engineers Course Handout.pptx
Biology for Computer Engineers Course Handout.pptx
 
POWER SYSTEMS-1 Complete notes examples
POWER SYSTEMS-1 Complete notes  examplesPOWER SYSTEMS-1 Complete notes  examples
POWER SYSTEMS-1 Complete notes examples
 
An experimental study in using natural admixture as an alternative for chemic...
An experimental study in using natural admixture as an alternative for chemic...An experimental study in using natural admixture as an alternative for chemic...
An experimental study in using natural admixture as an alternative for chemic...
 
UNIT III ANALOG ELECTRONICS (BASIC ELECTRONICS)
UNIT III ANALOG ELECTRONICS (BASIC ELECTRONICS)UNIT III ANALOG ELECTRONICS (BASIC ELECTRONICS)
UNIT III ANALOG ELECTRONICS (BASIC ELECTRONICS)
 
Oxy acetylene welding presentation note.
Oxy acetylene welding presentation note.Oxy acetylene welding presentation note.
Oxy acetylene welding presentation note.
 

Appium workshop technopark trivandrum

  • 1. Appium workshop Syam Sasi Martin Schneider Technopark Trivandrum, 18.05.2019
  • 2.
  • 3. About us Syam Sasi Senior Software Engineer @ Carousell https://about.me/syamsasi Martin Schneider Senior Software Engineer @ Carousell mart.schneider@gmail.com
  • 6. A brief (overly simplified) history of UI test automation 1993: QA Partner (Segue Software) 1996: QA Partner → Silk Test 2004: Selenium created at ThoughtWorks (Jason Huggins) 2005: Robot Framework (Pekka Klärck) 2006: Borland acquires Silk Test 2007: WebDriver (Simon Stewart) 2008: Selenium Grid 2008: Cucumber (Aslak Hellesøy) 2009: Selenium + WebDriver = Selenium 2.0 2009: MicroFocus acquires Borland 2009: Silk4J 2011: iOS Auto (Dan Cuellar) 2013: Espresso 2014: Appium 1.0 (Saucelabs) 2017: Silk Webdriver © Martin Schneider, mart.schneider@gmail.com
  • 7. The history of Appium 2011: Dan Cuellar creates iOSAuto, a tool for iOS automation written in C# 2012: Dan presents Appium during a Lightning Talk at the 2012 Selenium Conference in London 2012: Dan rewrites appium in Python and open-sources it under the Apache 2 license 2012: Cooperation with Jason Huggins (Selenium co-founder) starts 2013: Saucelabs starts backing Appium 2013: Appium is rewritten using node.js 2013: Android support is added → first truly platform-independent mobile testing framework 2014: Appium 1.0 is released 2016: Drivers for Windows desktop and youi.tv automation are added 2016: Appium is donated to the JS Foundation The journey continues! http://appium.io/history.html https://github.com/appium http://appium.io/ © Martin Schneider, mart.schneider@gmail.com
  • 8. Coffee break reading material ;-) https://www.infoq.com/news/2018/04/cucumber -bdd-ten-years https://www.seleniumhq.org/about/history.jsp http://appium.io/history.html © Martin Schneider, mart.schneider@gmail.com
  • 10. Appium philosophy 1. You shouldn't have to recompile your app or modify it in any way in order to automate it. 2. You shouldn't be locked into a specific language or framework to write and run your tests. 3. A mobile automation framework shouldn't reinvent the wheel when it comes to automation APIs. 4. A mobile automation framework should be open source, in spirit and practice as well as in name!
  • 14. Appium architecture Appium client Appium server JSONWP ● Client-server architecture ● Server is written in node.js ● Clients are available for all major programming languages UIAutomator 2 XCUITest
  • 15. Selenium WebDriver driver = new FirefoxDriver(); driver.get("http://www.google.com"); WebElement element = driver.findElement(By.name("q")); element.sendKeys("Appium Meet-up"); element.submit(); ...
  • 16. Appium AppiumDriver driver = driver = new AppiumDriver(new URL("http://127.0.0.1:4723/wd/hub"), capabilities); IOSElement element = driver.findElement(By.name("search")); element.sendKeys("Appium Meet-up"); element.submit(); ...
  • 18. Appium vs. native frameworks ● Appium is highly portable. ● We can use the same tool to automate Android, iOS, Web (with Selenium) and Windows Desktop applications → multi-platform test frameworks. ● Appium is slower than native automation. ● There is an overhead that comes with the client/server architecture.
  • 19. Appium basics Our first Appium test: ● /appium-demo/src/test/java/io/github/martinschneider/appium/android/CounterTest01.java ● /appium-demo/src/test/java/io/github/martinschneider/appium/android/CounterTest02.java
  • 22. General Capabilities automationName - XCUITest or UiAutomator2 platformName - iOS or Android platformVersion - 7.0, 11.0 deviceName - iPhone6, Samsung Galaxy S8 app - /path/to/apk, app or ipa fullReset - true or false newCommandTimeout - in seconds
  • 24. Why Appium Desktop? ● Inspect Android and iOS App UI ● Search for a mobile element ● Record the actions
  • 26. Inspecting Android App 1. Run appium command in command prompt/terminal 2. Open Appium Desktop 3. Click on Appium > New Session Window 4. Enter the following capabilities and save Note: Pixel is the name of the emulator { "platformName":"android", "deviceName":"Pixel", "automationName":"UiAutomator2", "app":"/path/to/apk/file", "avd","Pixel" }
  • 28. Android locator types ● accessibility ● id ● xpath ● class ● uiAutomator ● image http://appium.io/docs/en/commands/element/find-elements/ https://saucelabs.com/blog/advanced-locator-strategies
  • 29. Android locator types ● /appium-demo/src/test/java/io/github/martinschneider/appium/android/CounterTest03.java ● /appium-demo/src/test/java/io/github/martinschneider/appium/android/CounterTest04.java
  • 31. Appium inspector { "platformName" : "android", "appPackage": "com.thecarousell.Carousell" , "appActivity": "com.thecarousell.Carousell.activities.EntryActivity" , "appPath": "/Users/martinschneider/carousell.apk", "deviceName" : "test", }
  • 33. Macaca inspector ● https://macacajs.github.io/app-inspector/ ● npm i app-inspector -g ● adb devices ● app-inspector -u YOUR-DEVICE-ID ● http://10.0.1.117:5678 ● Does not require Appium or an Appium session
  • 34. Macaca inspector ● https://macacajs.github.io/app-inspector/ ● npm i app-inspector -g ● app-inspector -u YOUR-DEVICE-ID ● http://10.0.1.117:5678/
  • 36. Waiting strategies ● /appium-demo/src/test/java/io/github/martinschneider/appium/android/LoginTest01.java ● /appium-demo/src/test/java/io/github/martinschneider/appium/android/LoginTest02.java ● /appium-demo/src/test/java/io/github/martinschneider/appium/android/LoginTest03.java ● /appium-demo/src/test/java/io/github/martinschneider/appium/android/LoginTest04.java
  • 37. Static wait Thread.sleep(3000); ● Fixed duration for every execution ○ either too long (waste of execution time) ○ or too short (test will still fail) ● Remember: Test behave differently ○ on different environments ○ under different network conditions ○ etc. ● Just ugly and wrong! Avoid at all costs! © Martin Schneider, mart.schneider@gmail.com
  • 38. Implicit wait driver.manage().timeouts().implicitlyWait(10, TimeUnit.SECONDS); ● Will wait up to the specified time for every element. ● Speeds up test execution locally but also slows down overall test execution because it is a global setting (no ability to fail fast)! ● Better than static waits but still not quite convenient enough…. © Martin Schneider, mart.schneider@gmail.com
  • 39. WebDriverWait wait = new WebDriverWait(driver, 10); wait.until(presenceOfElementLocated(goToLogin)) .click(); wait.until(presenceOfElementLocated(username)) .sendKeys(username); ● Waits until a condition is met. ● This isn’t limited to visibility. ● We can implement custom conditions. ● We can use different timeouts for different use-cases! Explicit wait © Martin Schneider, mart.schneider@gmail.com
  • 41. The X Y Coordinates
  • 42. The Touch Action Class ● /appium-demo/src/test/java/io/github/martinschneider/appium/android/swipe/SwipeTest.java 1. Touch Action *press*release*moveTo*tap*wait*longPress.cancel.perform TouchAction().press(el1).moveTo(el2).release(); 2. Multi Touch action1 = TouchAction().tap(el1); action2 = TouchAction().tap(el2); MultiAction().add(action1).add(action2).perform();
  • 44. Page objects © Martin Schneider, mart.schneider@gmail.com ● De-facto standard design pattern in UI test automation. ● A page object is an object-oriented class that serves as an interface to a page/screen of your AUT. ● Goals: enhance maintenance, avoid code duplication ● Ideally one page object per page/screen/dialog/component. ● Tests don’t care about the layout and locators of your app. They just interact with page objects. ● We can use mechanisms like Dependency Injection to simplify the use of page objects.
  • 45. Theory is boring... ● /appium-demo/src/test/java/io/github/martinschneider/appium/android/LoginTest05.java ● /appium-demo/src/test/java/io/github/martinschneider/appium/android/LoginTest06.java ● /appium-demo/src/test/java/io/github/martinschneider/appium/android/LoginTest07.java
  • 46. How to design a test framework? Some thoughts
  • 47. How to design a test framework? © Martin Schneider, mart.schneider@gmail.com ● Don’t re-invent the wheel but combine existing tools in a way that best fit your use-case. ● Always keep re-usability, adaptability, extensibility and scalability in mind. ● A quick (and “dirty”) PoC is a start but what’s your use-case in 6 months / 1 year / 5 years… Is your design ready for the change? ● → Have a vision and lay the foundation accordingly. ● Good design now = less refactoring later. ● Test automation requires software engineers (test engineer = engineer). ● Apply the same (or better) practices you have for building the solutions you sell to your customers, always lead by example (quality!). ● Powerful under the hood but super-easy to use. ● A framework is cool but don’t forget the culture in which it is used. https://www.linkedin.com/in/martin-schneider
  • 48. How to design a test framework? © Martin Schneider, mart.schneider@gmail.com Core framework Business model Page objects and DTOs Tests Testdata Cloud integration 3rd party integrations Test helper API layer EXAMPLE Robot
  • 50. Locator Strategy for iOS Accessibility ID driver.findElement(MobileBy.AccessibilityID ("foo")); iOS NS Predicates driver.findElementByIosNsPredicate (tableViews()[1].cells().firstWithPr edicate("label == 'Olivia' " )); iOS Class Chain driver.findElement(MobileBy.iOSClassChain("**/XCUIElementTypeCell[`nam e BEGINSWITH " C"`]/XCUIElementTypeButton[10]" )); ● /appium-demo/src/test/java/io/github/martinschneider/appium/ios/IOSTest.java
  • 51. Real device vs. simulators/emulators
  • 52. Appium On Real Devices - Android © Martin Schneider, mart.schneider@gmail.com 1. Enable USB Debugging 2. Connect the device using usb 3. Note down the udid 4. Device is detected when run the adb devices command https://developer.android.com/studio/debug/dev-options
  • 53. Appium On Real Devices - iOS © Martin Schneider, mart.schneider@gmail.com 1. cd /usr/local/lib/node_modules/appium/node_modules/appium- xcuitest-driver/WebDriverAgent 2. mkdir -p Resources/WebDriverAgent.bundle 3. /bin/bash ./Scripts/bootstrap.sh -d 4. brew install carthage 5. brew install libimobiledevice --HEAD 6. npm install -g ios-deploy 7. UI Automation enabled on iOS device 8. Xcode has proper code sign enabled http://appium.io/docs/en/drivers/ios-xcuitest-real-devices/
  • 54. Which one I need? © Martin Schneider, mart.schneider@gmail.com
  • 56. Next question: How can we scale this? © Martin Schneider, mart.schneider@gmail.com
  • 57. Next question: How can we scale this? © Martin Schneider, mart.schneider@gmail.com
  • 58. On premise vs. cloud ● Full control ○ Number of devices ○ Types of devices ○ Software libraries ○ ... ● No maintenance required ● Fixed costs ● Support ● Maintenance ○ replace devices ○ fix issues ○ infrastructure ○ ... ● Less flexibility ○ Available devices ○ Software update cycle? (Appium, Java) © Martin Schneider, mart.schneider@gmail.com
  • 59. Two approaches towards cloud testing #1: Client-side execution Step 1: Upload your APP to the cloud Step 2: Create a WebDriver instance capabilities.setCapability("app", appUrl); new AppiumDriver("http://cloud.com/wd/hub", capabilities); Step 3: Execute your tests as before For example, Browserstack, Saucelabs, pCloudy... © Martin Schneider, mart.schneider@gmail.com
  • 60. Two approaches towards cloud testing #2: Server-side execution Step 1: Upload your APP to the cloud Step 2: Package and upload your tests to the cloud Step 3: Tests get executed on the cloud For example, AWS Devicefarm (public cloud) © Martin Schneider, mart.schneider@gmail.com
  • 61. Client- vs. server-side execution ● Easier migration ○ Execution flow remains the same ○ Reporting and CI remain the same ● More control ○ Software updates on the client side ○ easier to use a mixed/hybrid mode (=use different cloud providers or local + cloud) ● Performance (maybe) ● Network latency ● Trust and compliance ● Integration overhead ○ Test results and reporting ○ Network challenges © Martin Schneider, mart.schneider@gmail.com
  • 62. Factors to consider What’s your use-case? ● Devices ○ specific models, manufacturers, OS versions ● Parallelisation ○ How to distribute n tests across m devices efficiently (each test runs once)? ○ How to run n tests on m devices in parallel (each test runs m times)? ● Time constraints, execution speed, waiting times ○ run tests once a day (“nightly tests”) → not time-critical ○ run tests multiple times a day to verify changes → highly time-critical ● Client- vs. server execution mode ● API support ● Cost and pricing models ● Future use-cases © Martin Schneider, mart.schneider@gmail.com
  • 63. Device models ● In the US Apple and Samsung cover 81% of the market (UK 87%, Singapore 82%, Australia 89% etc.) ● What about Xiaomi, Oppo, Vivo, Lyf...? © Martin Schneider, mart.schneider@gmail.com
  • 64. Device market share in India © Martin Schneider, mart.schneider@gmail.com Source: https://deviceatlas.com/
  • 65. Device models ● Huawei (13,3%) surpassed Apple (11,9%) in market share in Q2/2018 ● Q1/2019: 19% global market share © Martin Schneider, mart.schneider@gmail.com
  • 66. Device models Market specifics ● India: 20% Xiaomi (#3) = 2/3 are neither Apple nor Samsung ● Myanmar (2018): 19% Oppo (#2), 18% Vivo (#3), 13% Xiaomi (#4), 11% Huawei (#5) = 70% not Apple and Samsung ● Pakistan: 11% QMobile (#2) ● Bangladesh: 14% Symphony (#2) Sources: https://www.gartner.com/en/newsroom/press-releases/2018-08-28-gartner-says-huawei-secured-no-2- worldwide-smartphone-vendor-spot-surpassing-apple-in-second-quarter, https://deviceatlas.com/ © Martin Schneider, mart.schneider@gmail.com
  • 67. Device models ● AWS Device Farm doesn't have any Huawei, Xiaomi, Oppo or Vivo models (in their public cloud) ● Browserstack only supports Samsung, Google and Apple phones (and one OnePlus model) Sources: https://www.gartner.com/en/newsroom/press-releases/2018-08-28-gartner-says-huawei-secured-no-2- worldwide-smartphone-vendor-spot-surpassing-apple-in-second-quarter, https://deviceatlas.com, https://www.browserstack.com/list-of-browsers-and-platforms/app_automate, http://awsdevicefarm.info © Martin Schneider, mart.schneider@gmail.com
  • 68. Demos We will run the same login test on AWS Devicefarm, Browserstack and locally. AWS Devicefarm ● package the test configuration into a test spec and upload to AWS ● upload the APK file to AWS ● package our tests (+framework) and upload to AWS ● select an available device (using device filters) ● execute the tests and process the results Browserstack ● upload the APK file to Browserstack ● configure the execution (this includes the device selection) using Capabilities ● execute the tests and process the results www.justtestlah.qa https://medium.com/@mart.schneider/mobile-test-automation-using-aws-device-farm-6bcf825fa27d © Martin Schneider, mart.schneider@gmail.com
  • 69. Appium tips and tricks
  • 70. #1 Network Conditions ● Toggle Airplane - driver.toggleAirplaneMode (); ● Toggle Data - driver.toggleData(); ● Toggle Wifi - driver.toggleWifi();
  • 71. #2 Android Emulator commands ● Send SMS - driver.sendSMS("555-123-4567", "Hey?"); ● GSM Call - driver.makeGsmCall("5551234567", GsmCallActions.CALL); ● GSM Signal - driver.setGsmSignalStrength(GsmSignalStrength.GOOD); ● Geo Location - driver.setLocation(new Location(49, 123, 10));
  • 72. #3 Dealing With An Element When Visibility Is False // first, find our element WebElement ref = wait .until(ExpectedConditions .presenceOfElementLocated (element)); // get the location and dimensions of the reference element, and find its center point Rectangle rect = ref.getRect(); int refElMidX = rect.getX() + rect.getWidth() / 2; int refElMidY = rect.getY() + rect.getHeight() / 2; // set the center point of our desired element; w int desiredElMidX = refElMidX; int desiredElMidY = refElMidY - rect.getHeight(); // perform the TouchAction that will tap the desired point TouchAction action = new TouchAction<>(driver); action.press(PointOption.point(desiredElMidX, desiredElMidY )); action.waitAction(WaitOptions.waitOptions(Duration.ofMillis(500))); action.release(); action.perform();
  • 73. #4 Speeding Up Your Tests ● Deeplinks driver.get("theapp://login/" + AUTH_USER + "/" + AUTH_PASS); ● OptionalIntentArguments caps.setCapability("optionalInentArguments", String.format("-e "username" "%s" -e "password" "%s"", AUTH_USER, AUTH_PASS));
  • 74. #5 Fine Tuning The Capabilities - Cross Platform ● Cross Platform ○ noReset ○ fullReset ○ isHeadless
  • 75. #6 Fine Tuning The Capabilities - Android ● Android ○ disableAndroidWatchers ○ autoGrantPermissions ○ skipUnlock ○ ignoreUnimportantViews
  • 76. #7 Fine Tuning The Capabilities - iOS ● iOS ○ usePrebuildWDA and derivedDataPath ○ useJSONSource ○ iosInstallPause ○ maxTypingFrequency ○ realDeviceScreenShotter ○ simpleIsVisibleCheck
  • 77. #8 Testing App Upgrades Android driver.installApp("/path/to/apk" ); driver.startActivity(activity); iOS HashMap<String, String> bundleArgs = new HashMap<>(); bundleArgs.put("bundleId", BUNDLE_ID); driver.executeScript("mobile: terminateApp" , bundleArgs); HashMap<String, String> installArgs = new HashMap<>(); installArgs.put("app", appUpgradeVersion ); driver.executeScript("mobile: installApp" , installArgs); driver.executeScript("mobile: launchApp" , bundleArgs);
  • 78. #9 Switching Between Apps ● Android driver.startActivity(settingsAppPackageName , settingsAppActivityName ); ● iOS // launch the photos app (with the special bundle id seen below) HashMap<String, Object> args = new HashMap<>(); args.put("bundleId", "com.apple.mobileslideshow" ); driver.executeScript("mobile: launchApp" , args); // re-activate that AUT (in this case The App) args.put("bundleId", "io.cloudgrey.the-app" ); driver.executeScript("mobile: activateApp" , args);
  • 79. #10 Testing The Push Notifications 1. Kill The App driver.terminateApp(bundleId or pkg ); 2. Open The Notification Pannel a. Android driver.openNotifications (); b. iOS Swipe From Top Down to show the notification centre 3. Wait For Push Notification Content 4. Close The Panel and Relaunch The App driver.activateApp(bundleId or pkg );
  • 80. #11 Automating Custom iOS Alerts wait.until(ExpectedConditions .alertIsPresent ()); HashMap<String, String> args = new HashMap<>(); args.put("action", "getButtons"); List<String> buttons = (List<String>)driver.executeScript("mobile: alert", args); // find the text of the button which isn't 'OK' or 'Cancel' String buttonLabel = null; for (String button : buttons) { if (button.equals("OK") || button.equals("Cancel")) { continue;} buttonLabel = button;} if (buttonLabel == null) { throw new Error("Did not get a third alert button as we were expecting"); } args.put("action", "accept"); args.put("buttonLabel", buttonLabel); driver.executeScript("mobile: alert" , args);
  • 81. #12 Automating A Picker Wheel On iOS 1. Using SendKeys pickerWheelElement.sendKeys("March"); 2. Picker Wheel Value HashMap<String, Object> params = new HashMap<>(); params.put("order", "next"); params.put("offset", 0.15); params.put("element", ((RemoteWebElement) pickerWheelElement).getId()); driver.executeScript("mobile: selectPickerWheelValue", params);
  • 82. #13 Video Recording The Test Execution IOSStartScreenRecordingOptions iOSStartScreenRecordingOptions =new IOSStartScreenRecordingOptions().withVideoQuality(IOSStartSc reenRecordingOptions.VideoQuality.HIGH).withTimeLimit(Durati on.ofSeconds(SCREEN_RECORD_DURATION)); driver.startRecordingScreen(iOSStartScreenRecordingOptions); record = ((IOSDriver) driver).stopRecordingScreen(); byte[] decode = Base64.getDecoder().decode(record); File videoFile =new File(new StringBuilder().append(“MyVideo.Mp4”).toString()); FileUtils.writeByteArrayToFile(videoFile, decode);
  • 83. #14 Parallel And Distributed Testing ● Running multiple Appium servers, and sending one session to each server ● Running one Appium server, and sending multiple sessions to it ● Running one or more Appium servers behind the Selenium Grid Hub, and sending all sessions to the Grid Hub ● Leveraging a cloud provider (which itself is running many Appium servers, most likely behind some single gateway)
  • 84. #15 Desktop App Automation ● Appium for Mac - https://github.com/appium/appium-for-mac ● WinAppDriver - https://github.com/Microsoft/WinAppDriver
  • 85. Quiz Time Go to https://kahoot.it
  • 86. References ● http://appium.io ● https://appiumpro.com/editions ● https://github.com/SrinivasanTarget/awesome-appium ● https://github.com/appium/appium/tree/master/docs/en/advanced-concepts ● https://github.com/singapore-appium-meetup/meetups ● https://www.justtestlah.qa