appium tips & inneractive integration

23
INNERACTIVE APPIUM TIPS & INNERACTIVE INTEGRATION

Upload: gil-sheps

Post on 11-Jan-2017

217 views

Category:

Software


2 download

TRANSCRIPT

Page 1: Appium tips & Inneractive integration

INNERACTIVEAPPIUM TIPS &

INNERACTIVE INTEGRATION

Page 2: Appium tips & Inneractive integration

GAL AVIVVP R&D

Page 3: Appium tips & Inneractive integration

THE BIG IDEA

Inneractive is a global independent mobile ad exchange focused on powering native and video ads

Page 4: Appium tips & Inneractive integration

AT A GLANCE

630M

90EMPLOYEES

UNIQUE USERS

2007FOUNDED

NEW YORK

LONDON

SAN FRANCISCO

TEL AVIVBEIJING

70%OF REVENUE COMES FROM THE US

AD REQUESTSPROCESSED PER MINUTE

70%IN-APP SUPPLY

5MANDROIDUSERS

66%IPHONEUSERS

34%

Page 5: Appium tips & Inneractive integration

5m/min 150 ms

$$$$$

WHAT WE DO?

Page 6: Appium tips & Inneractive integration

GIL SHEPSAUTOMATION DEVELOPER

2010 - 2011 – QA Engineer at MobileMax

2011 – 2012 - QA Engineer at Tabtale

2012 – 2015 - QA Engineer at Inneractive

2016 – Today – Automation Developer at Inneractive

Proud Dad to Yahav.

Page 7: Appium tips & Inneractive integration

Versatile modularity (cross products) Third party platform independency Stand-alone tool Java support Multi-platform No installation needed (third-party platform)

WHY?

Page 8: Appium tips & Inneractive integration

Owner Platform Where When Limitations Phase & Scope Budget

GETTINGREADY

Page 9: Appium tips & Inneractive integration

ALTERNATIVE WE CONSIDERED

  Appthwack Appurify Saucelabs Local – Appium Perfecto Mobile Test Droid Device Anywhere

Server X not real time ? V X X X V

Client V ? X X V V V

Scripts Engine Cucamber, kalabash ? Appium Any language Appium Appium

GUI-based commands, Java API, other test framework

including HP UFT, IBM Rational, Selenium

Real \ Virtual device Real Real Virtual Cost per device Real Real Real

Notes Isn't suitable to server

Inability to communicate

They have beta program with real

devices

We'll have to manage the

server ourself and we don't want that

Cost per deviceno

manual testing sulotion

Could be another fee per used devices\time

Links https://appthwack.com/ http://appurify.com/ https://saucelabs.com/

http://appium.io/ http://www.perfectomobile.com/

http://testdroid.com/pricing

http://www.keynote.com/solutions/testing/mobile-testing

Page 10: Appium tips & Inneractive integration

Owner - me Platform- Maven project using

Java using intellij Where - Sauce Labs / Perfecto Mobile When – Nightly / version release Limitations – Video / Unsupported

iOS elements

OUR PRACTICE

Page 11: Appium tips & Inneractive integration

INNERACTIVE PLATFROM

MAVEN FAILSAFE SPRING INFRA

API

MOBILETESTS

Page 12: Appium tips & Inneractive integration

SDK MOAT viewability tracking

Auto-redirect blocker

Accurate data extraction to enable better targeting

Backward compatibility with Android/iOS versions

Access to all relevant ad serving protocols (video and rich media)

Fully customizable native advertising settings

STORY video – innovative in-feed video with storytelling abilities

Page 13: Appium tips & Inneractive integration

HOW APPIUM HELPS TEST INNERACTIVE PRODUCTS

Find and click on elements UI verification Native Event Listener

verification API verification Image recognition Webview verification

UI verification API verification Image recognition Webview verification E2E flow (client-server)

UI verification Webview verification

Mobile web

Page 14: Appium tips & Inneractive integration

Appium is not enough Give identity to all elements Don’t use full path Use resetApp() after test Use one kind of timer

APPIUMTIPS

https://github.com/appium/appium/releases:// . / / -https github com appium java client

Page 15: Appium tips & Inneractive integration

((JavascriptExecutor) driver).executeScript("return document.getElementById(’iaAD').height");((JavascriptExecutor) driver).executeScript("return document.getElementById(’iaAD'). width");

https://discuss.appium.io/t/is-javascriptexecutor-works-for-appium/3597

VERIFY WEBVIEW DIMENSIONS

* don’t forget to switch context

Page 16: Appium tips & Inneractive integration

private String fileName = "/storage/emulated/legacy/config.txt";private String fileNameZero = "/storage/emulated/0/config.txt";@Overridepublic String readConfigFile() { byte[] data; try { logger.info("trying to read from " + fileName); data = appiumDriver.pullFile(fileName); } catch (Exception e) { try { logger.info("trying to read from " + fileNameZero); data = appiumDriver.pullFile(fileNameZero); } catch (Exception e1) { logger.info("trying to read from " + fileNameSuace); data = appiumDriver.pullFile(fileNameSuace); } } String logs = new String(data); logger.info(logs); return logs;}

PULLFILE()

Page 17: Appium tips & Inneractive integration

((IOSDriver) appiumDriver).findElementByIosUIAutomation(asset).click();((AndroidDriver) appiumDriver).currentActivity().equals(SETTINGNATIVEACTIVITY))((AndroidDriver) appiumDriver).pressKeyCode(AndroidKeyCode.HOME);((AndroidDriver) appiumDriver).pressKeyCode(AndroidKeyCode.KEYCODE_BACK);((AndroidDriver) appiumDriver).pressKeyCode(AndroidKeyCode.KEYCODE_APP_SWITCH);

https://github.com/appium/appium-ios-driverhttps://github.com/appium/appium-android-driver

ANDROIDDRIVER & IOSDRIVER

Page 18: Appium tips & Inneractive integration

private void tryToClickOnAssetWithIDOrXpath(String asset, String UIElemnt) { try { ((IOSDriver) appiumDriver).findElementByIosUIAutomation(asset).click(); } catch (NoSuchElementException e) { appiumDriver.findElement(By.xpath("//" + UIElemnt + "[@name='" + asset + "'")).click(); }}

http://testdroid.com/tech/appium-tip-18-how-to-use-xpath-locators-efficiently

FIND ELEMENT BY XPATH - IOS

Page 19: Appium tips & Inneractive integration

appiumDriver.manage().timeouts().setScriptTimeout(long time,TimeUnit unit);appiumDriver.manage().timeouts(). pageLoadTimeout(long time,TimeUnit unit);appiumDriver.manage().timeouts().implicitlyWait(long time,TimeUnit unit);

public ClientUtils waitForInternalBrowserToLoaded(Long timoutSec) { changeToWebView(appiumDriver); appiumDriver.manage().timeouts().pageLoadTimeout(timoutSec, TimeUnit.SECONDS); changeToAppView(appiumDriver); return this;}

TIMEOUTS

Page 20: Appium tips & Inneractive integration

ExpectedConditions.visibilityOfElementLocatedExpectedConditions.presenceOfElementLocatedExpectedConditions.urlContainsExpectedConditions.elementToBeClickable

:// . . / / / / / / / / / / .https seleniumhq github io selenium docs api java org openqa selenium support ui ExpectedConditions html

WEBDRIVERWAIT + EXPECTEDCONDITIONS

@Overridepublic ClientUtils waitForActivity(final String activityName , long timeount) { logger.info("waitForActivity Activity : " + activityName); WebDriverWait uiWait = new WebDriverWait(appiumDriver, MINDAPPIUMDRIVERTIMEOUT); uiWait.until(new Predicate<WebDriver>() { @Override public boolean apply(WebDriver input) { if (((AndroidDriver) appiumDriver).currentActivity().equals(activityName)) { return true; } return false; } }); return this;}

Page 21: Appium tips & Inneractive integration

DEMORUNNING TESTS ON PERFECTO MOBILE

Page 22: Appium tips & Inneractive integration
Page 23: Appium tips & Inneractive integration

THANK YOU

GIL SHEPSAutomation Developer [email protected]

https://www.linkedin.com/in/gil-sheps