INNERACTIVE
APPIUM TIPS &
INNERACTIVE INTEGRATION
VP R&D
THE BIG
IDEA
Inneractive is a global independent
mobile ad exchange focused on
powering native and video ads
AT A
GLANCE
630M
90EMPLOYEES
UNIQUE USERS
2007FOUNDED
NEW YORK
LONDON
SAN
FRANCISCO
TEL AVIV
BEIJING
70%OF REVENUE
COMES FROM
THE US
AD REQUESTS
PROCESSED
PER MINUTE
70%IN-APP
SUPPLY
5M ANDROID
USERS
66% IPHONE
USERS
34%
5m/min 150 ms
$$$$$
WHAT WE
DO?
GIL SHEPS
AUTOMATION 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.
 Versatile modularity (cross products)
 Third party platform independency
 Stand-alone tool
 Java support
 Multi-platform
 No installation needed (third-party platform)
WHY?
 Owner
 Platform
 Where
 When
 Limitations
 Phase & Scope
 Budget
GETTING
READY
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 device
no
manual testing
sulotion
Could be another fee per used
devicestime
Links https://appthwack.com/
http://appurify.com
/
https://saucelabs.com
/
http://appium.io/
http://www.perfectom
obile.com/
http://testdroid.com/pricin
g
http://www.keynote.com/solutions/tes
ting/mobile-testing
 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
INNERACTIVE PLATFROM
MAVEN FAILSAFE SPRING INFRA
API
MOBILE
TESTS
 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
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
 Appium is not enough
 Give identity to all elements
 Don’t use full path
 Use resetApp() after test
 Use one kind of timer
APPIUM
TIPS
https://github.com/appium/appium/releases
https://github.com/appium/java-client
((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
private String fileName = "/storage/emulated/legacy/config.txt";
private String fileNameZero = "/storage/emulated/0/config.txt";
@Override
public 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()
((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-driver
https://github.com/appium/appium-android-driver
ANDROIDDRIVER &
IOSDRIVER
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
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
ExpectedConditions.visibilityOfElementLocated
ExpectedConditions.presenceOfElementLocated
ExpectedConditions.urlContains
ExpectedConditions.elementToBeClickable
https://seleniumhq.github.io/selenium/docs/api/java/org/openqa/selenium/support/ui/ExpectedConditions.html
WEBDRIVERWAIT +
EXPECTEDCONDITIONS
@Override
public 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;
}
RUNNING TESTS ON PERFECTO MOBILE
THANK YOU
GIL SHEPS
Automation Developer
Gils@inner-active.com
https://www.linkedin.com/in/gil-sheps

Appium tips & Inneractive integration

  • 1.
  • 2.
  • 3.
    THE BIG IDEA Inneractive isa global independent mobile ad exchange focused on powering native and video ads
  • 4.
    AT A GLANCE 630M 90EMPLOYEES UNIQUE USERS 2007FOUNDED NEWYORK LONDON SAN FRANCISCO TEL AVIV BEIJING 70%OF REVENUE COMES FROM THE US AD REQUESTS PROCESSED PER MINUTE 70%IN-APP SUPPLY 5M ANDROID USERS 66% IPHONE USERS 34%
  • 5.
  • 6.
    GIL SHEPS AUTOMATION 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.
  • 7.
     Versatile modularity(cross products)  Third party platform independency  Stand-alone tool  Java support  Multi-platform  No installation needed (third-party platform) WHY?
  • 8.
     Owner  Platform Where  When  Limitations  Phase & Scope  Budget GETTING READY
  • 9.
    ALTERNATIVE WE CONSIDERED AppthwackAppurify 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 device no manual testing sulotion Could be another fee per used devicestime Links https://appthwack.com/ http://appurify.com / https://saucelabs.com / http://appium.io/ http://www.perfectom obile.com/ http://testdroid.com/pricin g http://www.keynote.com/solutions/tes ting/mobile-testing
  • 10.
     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
  • 11.
    INNERACTIVE PLATFROM MAVEN FAILSAFESPRING INFRA API MOBILE TESTS
  • 12.
     MOAT viewabilitytracking  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
  • 13.
    HOW APPIUM HELPSTEST 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
  • 14.
     Appium isnot enough  Give identity to all elements  Don’t use full path  Use resetApp() after test  Use one kind of timer APPIUM TIPS https://github.com/appium/appium/releases https://github.com/appium/java-client
  • 15.
    ((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
  • 16.
    private String fileName= "/storage/emulated/legacy/config.txt"; private String fileNameZero = "/storage/emulated/0/config.txt"; @Override public 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()
  • 17.
    ((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-driver https://github.com/appium/appium-android-driver ANDROIDDRIVER & IOSDRIVER
  • 18.
    private void tryToClickOnAssetWithIDOrXpath(Stringasset, 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
  • 19.
    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
  • 20.
    ExpectedConditions.visibilityOfElementLocated ExpectedConditions.presenceOfElementLocated ExpectedConditions.urlContains ExpectedConditions.elementToBeClickable https://seleniumhq.github.io/selenium/docs/api/java/org/openqa/selenium/support/ui/ExpectedConditions.html WEBDRIVERWAIT + EXPECTEDCONDITIONS @Override public ClientUtilswaitForActivity(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; }
  • 21.
    RUNNING TESTS ONPERFECTO MOBILE
  • 23.
    THANK YOU GIL SHEPS AutomationDeveloper Gils@inner-active.com https://www.linkedin.com/in/gil-sheps