Appium tips & Inneractive integration

  • View
    200

  • Download
    2

Embed Size (px)

Text of Appium tips & Inneractive integration

PowerPoint Presentation

INNERACTIVE

APPIUM TIPS &INNERACTIVE INTEGRATION

GAL AVIV

VP R&D

THE BIG IDEA

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

AT A GLANCE630M90EMPLOYEESUNIQUE USERS2007FOUNDEDNEW YORKLONDONSAN FRANCISCOTEL AVIVBEIJING 70%OF REVENUE COMES FROM THE USAD REQUESTSPROCESSED PER MINUTE70%IN-APP SUPPLY5MANDROIDUSERS66%IPHONEUSERS34%

#PAGE //

5m/min 150 ms$$$$$

WHAT WE DO?

GIL SHEPSAUTOMATION DEVELOPER2010 - 2011 QA Engineer at MobileMax2011 2012 - QA Engineer at Tabtale2012 2015 - QA Engineer at Inneractive2016 Today Automation Developer at InneractiveProud Dad to Yahav.

Versatile modularity (cross products)Third party platform independencyStand-alone toolJava supportMulti-platformNo installation needed (third-party platform)

WHY?

OwnerPlatformWhereWhenLimitationsPhase & ScopeBudget

GETTINGREADY

ALTERNATIVE WE CONSIDEREDAppthwackAppurifySaucelabsLocal AppiumPerfecto MobileTest DroidDevice AnywhereServerX not real time?VXXXVClientV?X XVVVScripts EngineCucamber, kalabash?AppiumAny languageAppiumAppiumGUI-based commands, Java API, other test framework including HP UFT, IBM Rational, SeleniumReal \ Virtual deviceRealRealVirtualCost per deviceRealRealRealNotesIsn't suitable to serverInability to communicateThey have beta program with real devicesWe'll have to manage the server ourself and we don't want thatCost per deviceno manual testing sulotionCould be another fee per used devices\timeLinkshttps://appthwack.com/http://appurify.com/https://saucelabs.com/http://appium.io/http://www.perfectomobile.com/http://testdroid.com/pricinghttp://www.keynote.com/solutions/testing/mobile-testing

Owner - mePlatform- Maven project using Java using intellij Where - Sauce Labs / Perfecto MobileWhen Nightly / version releaseLimitations Video / Unsupported iOS elements

OUR PRACTICE

INNERACTIVE PLATFROM

MAVENFAILSAFE

SPRINGINFRA

API

MOBILE

TESTS

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

HOW APPIUM HELPS TEST INNERACTIVE PRODUCTSFind and click on elementsUI verificationNative Event Listener verificationAPI verificationImage recognitionWebview verification

UI verificationAPI verificationImage recognitionWebview verificationE2E flow (client-server)

UI verificationWebview verification

Mobile web

Appium is not enoughGive identity to all elementsDont use full pathUse resetApp() after testUse one kind of timer

APPIUMTIPShttps://github.com/appium/appium/releaseshttps://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* dont forget to switch context

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()

((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

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.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() { @Override public boolean apply(WebDriver input) { if (((AndroidDriver) appiumDriver).currentActivity().equals(activityName)) { return true; } return false; } }); return this;}

DEMORUNNING TESTS ON PERFECTO MOBILE

THANK YOUGIL SHEPSAutomation DeveloperGils@inner-active.comhttps://www.linkedin.com/in/gil-sheps