Selenium Camp 2016

34
MOBILE AUTOMATION MADE AWESOME

Transcript of Selenium Camp 2016

Creating an Open Source Project 0 to 100,000 Users

Mobile Automation Made Awesome

About The SpeakerDan Cuellar@thedancuellar

Creator of AppiumHead of Software Testing at FOODitPreviously at Shazam, Zoosk, and MicrosoftBS in Computer Science from Carnegie Mellon

Evolution

The Most Terrifying 5 Words IN TESTING

This All Sounds Familiar

Everything is not Awesome

Time to Spread the Word

What is AppiumAn implementation of the Selenium JSON-wire protocol that controls native and hybrid iOS and Android applicationThe most popular open source mobile functional testing framework

Appium PhilosophyUse standardized and sanctioned APIs and techniques

Code in the language of your choiceJava, C#, Python, Ruby, Objective-C, node.js, PHP, and more

Do not modify the application under test

Keep it free and open source

How Does it Work?Test ScriptJSON-Wire Protocol Request

JSON-Wire Protocol Response

HTTP

By the NumbersIn the last 3 yearsOver 3,000 Stars, 2,000 Forks on GitHubOver 150 Contributors and 5,000 commitsOver 150,000 downloads of Appium 1.0Over 3,000 issues closed

@Before public void setUp() throws Exception {

// set up appium File app = new File("/path/to/your/TestApp.app"); DesiredCapabilities capabilities = new DesiredCapabilities(); capabilities.setCapability("platformVersion", 9.1"); capabilities.setCapability("deviceName", "iPhone 6"); capabilities.setCapability("app", app.getAbsolutePath());

driver = new IOSDriver(new URL("http://127.0.0.1:4723/wd/hub"), capabilities); }The Code iOS Setup

@Before public void setUp() throws Exception {

// set up appium File app = new File(/path/to/my/test-app.apk"); DesiredCapabilities capabilities = new DesiredCapabilities(); capabilities.setCapability("deviceName","Android Emulator"); capabilities.setCapability("automationName",Android"); capabilities.setCapability("app", app.getAbsolutePath()); capabilities.setCapability("appPackage", com.yourcompany.testapp"); capabilities.setCapability("appActivity", ".HomeScreenActivity");

driver = new AndroidDriver(new URL("http://127.0.0.1:4723/wd/hub"), capabilities); }The Code Android Setup

WebElement el = driver.findElement(By.className("UIAButton"));

WebElement el = driver.findElement(By.xpath("//UIATextField[1]"));

WebElement el = driver.findElement(MobileBy.AccessibilityId("Done"));The Code Finding Elements

el.click();

el.sendKeys("Hello World");

driver.swipe(sliderLocation.getX(), sliderLocation.getY(), sliderLocation.getX()-100, sliderLocation.getY(), 1000);

The Code Actions

Each webview in your app is a context. Change context and automate as you would a webpage using regular selenium syntax.

driver.context(contextName);WebElement el = driver.findElement(By.cssSelector(".awesome"));el.click();Automating Web-Views

Whats new in Appium 1.5?Complete rewrite of the entire codebaseContinuous Integration and Unit TestsCommand line arguments are mostly capabilities nowCode of Conduct and Governance

Why Rewrite?3 years of patches and organic growthMany complaints about instabilityCode was not modular enoughOld and confusing ES5 codeCallback HellPoorly Tested

Whats Coming NextWindows Phone and Windows 10 application supportNew GUIsMultiple New iOS Back-endsAndroid backend rewrite using UIAutomator 2Better docs and onboarding materialAppium Foundation

Windows Support

https://github.com/2gis/Winium

New iOS Back-endsWebDriverAgenthttps://github.com/facebook/WebDriverAgentMultiple SimulatorsAll ApplicationsXCUITestCreated by AppleBetter support for future versions of iOS

Ohh, and One More Thing

Robots

How Does it Work?Calibrate the robot to map points in the physical world to points on a device screenRun an app on the device with Appium that can tell you what coordinates are being touchedTouch three places on the device and record the physical and device-centric coordinatesBuild a matrix to translate any point between the two systemsIntercept touch actions with the Appium Server and send them to the robot

The Math

Personal TAKEAWAYLife can be much broader once you discover one simple fact: Everything around you that you call life was made up by people that were no smarter than you and you can change it, you can influence it, you can build your own things that other people can use.

Once you learn that, you'll never be the same again.

-Steve Jobs

More InfoWebsite: http://www.appium.io

Slack: appium.slack.com

Forum: discuss.appium.io

GitHub: http://www.github.com/appium/appium