Selendroid - Selenium for Android

13
Selendroid - Selenium for Android Dominik Dary Google Test Automation Conference 2014

description

Selendroid is an open source test automation framework which drives off the UI of Android native and hybrid applications and the mobile web. Tests are written using the Selenium 2 client API. For testing no modification of app under test is required in order to automate it. This presentation demonstrates to the audience how easy it is to do mobile test automation. It shows how Selendroid can be used to test native and hybrid Android apps and how the Selenium Grid can be used for parallel testing on multiple devices. Advances topics like extending Selendroid itself at runtime and doing cross platform tests will be covered as well.

Transcript of Selendroid - Selenium for Android

Page 1: Selendroid - Selenium for Android

Selendroid - Selenium for Android

Dominik DaryGoogle Test Automation Conference 2014

Page 2: Selendroid - Selenium for Android

Who am I?

Dominik DaryEngineering Manager @ Twitter: @dominikdaryGithub: http://github.com/dominikdary

Disclaimer: My Opinions are my own.

Page 3: Selendroid - Selenium for Android

Selendroid

Open sourced on github:

– https://github.com/selendroid

Documentation:

– https://selendroid.ioMain Committers:

– eBay, Salesforce and Facebook

Getting help

– IRC : #selendroid on freenode

Android Test Automation

Page 4: Selendroid - Selenium for Android

Features

– The only mobile WebDriver that supports native & hybrid apps and testing the mobile web on Android versions (API 10 to 19)

– Full compatibility with the JSON Wire Protocol.– The app under test must not be modified – No jailbreak / rooting of devices– Interacts simultaneously with multiple Android devices– Supports hot plugging of hardware devices– Advanced Gestures are supported

Page 5: Selendroid - Selenium for Android

Testing In Action

Mobile WebHybridNative

WebElement button = driver.findElement( By.id("startUserRegistration"));button.click(); WebElement nameInput = driver.findElement(By.id("inputName"));Assert.assertEquals( nameInput.getText(), "Mr. Burns"); nameInput.clear();nameInput.sendKeys("GTAC 2014");

// Switch to the web view contextdriver.context("WEBVIEW");String vpOfEngineering = "John Williams";WebElement searchBox = driver.findElement(By.tagName("input"));searchBox.sendKeys(vpOfEngineering);driver.findElement( By.partialLinkText(vpOfEngineering)). click();

WebDriver driver = new RemoteWebDriver( DesiredCapabilities.android());driver.get("http://m.ebay.de"); WebElement element = driver.findElement( By.id("kw"));element.sendKeys("Nexus 6");element.submit();

Page 6: Selendroid - Selenium for Android

Selendroid Inspector

• View hierarchy• View UI element properties• UI screenshot with view

locator• Record the click actions• View HTML of a web view• XPath helper

Android Test Automation

Demo: http://youtu.be/JKZeF3eHljo

Page 7: Selendroid - Selenium for Android

Multi Touch Support

• Single finger example:TouchAction ta = new TouchActionBuilder().pointerDown(). pointerMove(x, y).pointerUp().build(); driver.getMultiTouchScreen().executeAction(ta);

• Multi finger example (these will be executed in parallel):TouchAction finger1 = new TouchActionBuilder().pointerDown().pause(100). pointerMove(x, y).pointerUp().build(); TouchAction finger2 = new TouchActionBuilder().pointerDown().pause(100). pointerMove(x, y).pointerUp().build(); MultiTouchAction multiAction = new MultiTouchAction(finger1, finger2); driver.getMultiTouchScreen().executeAction(multiAction);

Page 8: Selendroid - Selenium for Android

Extend Selendroid at Runtime

• First Mobile Test Automation Project that can be extended with your own code at runtime!

• Implement it:

• Build it

Page 9: Selendroid - Selenium for Android

Use Your Selendroid Extension

Page 10: Selendroid - Selenium for Android

Scaling using the Selenium Grid

Android Test Automation

Client

serverGRID HubClient

CI

server

server

Page 11: Selendroid - Selenium for Android

There is one more thing

We are proud to announce that we have shipped:

Selendroid 0.12.0

Page 12: Selendroid - Selenium for Android

Thank You!Questions or Comments?

Page 13: Selendroid - Selenium for Android

Selendroid in Action

– Native Demo: http://youtu.be/074BnGV0mS0 – Hybrid Demo: http://youtu.be/FGsKI6esKpw – Mobile Web Demo: http://goo.gl/41uvAx– Selendroid Article:

http://www.methodsandtools.com/tools/selendroid.php

Android Test Automation