Next level of Appium

23
www.tothenew.com Next Level of Appium By : Keshav Kashyap & Ankit Gupta

Transcript of Next level of Appium

Page 1: Next level of Appium

www.tothenew.com

Next Level of Appium By : Keshav Kashyap

& Ankit Gupta

Page 2: Next level of Appium

www.tothenew.com

Appium: Let’s enjoy Open Source

Open Source, Cross platform test automation tool to test mobile applicationIcon

Icon

Icon

Based on Client-Server Architecture using Webdriver

Established in January 2011Dan Cuellar, Jonathan Lipps & Others Contributors

Supports Native , Hybrid and Mobile Web appsSupports Both Android and iOS

Appium.io

Page 3: Next level of Appium

www.tothenew.com

Focus Points

UI AutomatorIconRecall Basic SetupIcon

Automate a sample appIconCommon Action KeywordsIcon

Page 4: Next level of Appium

www.tothenew.com

Agenda:-Areas We Cover

Appium Locators Android Actions

Icon Icon Icon

Desired Capabilities How to use UI Automator? Click, SendKeys

Android Key Events Mobile Gestures Demo

Icon Icon Icon

Home , Back , Enter, Click Camera

Swipe, Scroll, Tap Test Case Execution Report

Page 5: Next level of Appium

www.tothenew.com

Coverage Appium - Recall Previous Session Appium and Selendroid Desired Capabilities UI Automator and Challenges faced in finding elements Wait & Handling Keyboard Touch Actions and Wait Actions Android Key Events Android and iOS Scenarios Overall Flow using an e-Commerce app Alternative Solution of Appium Pros and Cons of Appium

Page 6: Next level of Appium

www.tothenew.com

Basic Requirements for Appium

Appium is an open source, cross-platform test automation tool for native, hybrid and mobile web apps, tested on simulators ,emulators and real devices.iOS Requirements•Mac OS •xCode •Apple Developer Tools (iPhone simulator SDK)Android Requirements•Android SDK, Java

Appium supports Android on OS X, Linux and Windows. So setup accordingly

Page 7: Next level of Appium

www.tothenew.com

Appium in a Nutshell APPIUM is a freely distributed open source mobile application UI testing

framework. Appium allows native, hybrid and web application testing and supports

automation test on physical devices as well as on emulator or simulator both.

It offers cross-platform application testing i.e. single API works for both Android and iOS platform test scripts.

It has NO dependency on Mobile device OS. Because, APPIUM has framework or wrapper that translate Selenium Webdriver commands into UIAutomation (iOS) or UIAutomator (Android) commands depending on the device type not any OS type.

Appium supports all languages that have Selenium client libraries like- Java, Objective-C, JavaScript with node.js, PHP, Ruby, Python, C# etc.

Page 8: Next level of Appium

www.tothenew.com

Appium Vs. Selendroid

Appium and Selendroid are quite similar :- both use Selenium WebDriver and used for native, hybrid and mobile web

apps both could run tests on emulator or real devices both are suitable for Cloud Based Testing Appium supports all Android API levels but there is one limitation. As it uses

UIAutomator for tests running on API>=17, for older APIs you need to run tests using Selendroid.

Selendroid or “Selenium for Android” is a test automation framework which is used ONLY for Android apps. Where as Appium is a open source automation tool used for Android, iOS and Firefox OS too.

Selendroid has multiple Android target API support (10 to 19) and it has no limitation with WebView testing like Appium which uses UIAutomator for API>=17.

Page 9: Next level of Appium

www.tothenew.com

Desired CapabilitiesDesired Capabilities are a set of keys and values sent to the Appium server to tell the server what kind of automation session we’re interested in starting up.

DesiredCapabilities capabilities = new DesiredCapabilities();capabilities.setCapability(CapabilityType.BROWSER_NAME, “”);capabilities.setCapability(“platformName”, “Android”);capabilities.setCapability(CapabilityType.VERSION, “4.4”);capabilities.setCapability(“deviceName”, “111bd508”);capabilities.setCapability(“app”, app.getAbsolutePath());capabilities.setCapability(“appPackage”, “com.example.android.contactmanager”);capabilities.setCapability(“appActivity”, “.ContactManager”);

driver = new AndroidDriver(new URL(“http://127.0.0.1:4723/wd/hub”), capabilities);

Page 10: Next level of Appium

www.tothenew.com

UI Automator

Go to SDK folder and open the tools folder. Open UIAutomatorViewer.On the actual device, open the app to the page you want to automate.In UI Automator Viewer, click on Device screenshot (second button).Click any element on the page and look in the Node detail window (there you will find details about the selected element: id, class, name, etc.)Use the info found (id, class) in Eclipse to click buttons, fill input fields

Page 11: Next level of Appium

www.tothenew.com

Mobile Keyboard Events Used in Mobile Automation

public static final int KEYCODE_ENTER Key code constant: Enter key. Constant Value: 66 (0x00000042)

public static final int KEYCODE_CAMERA Key code constant: Camera key. Used to launch a camera application or take pictures. Constant Value: 27 (0x0000001b)

public static final int KEYCODE_BACK Key code constant: Back key. Constant Value: 4 (0x00000004)

http://developer.android.com/reference/android/view/KeyEvent.html

Page 12: Next level of Appium

www.tothenew.com

Functions Used in Mobile Automation

Some Common Functions used in Mobile Automation :- tap() swipe() pinch() zoom() getNamedTextField() isAppInstalled() installApp() removeApp() launchApp() closeApp()

Page 13: Next level of Appium

www.tothenew.com

Common Issues of Appiumerror:- The following desired capabilities are required, but were not provided:device Name, platformNameAns. Add desired capabilities: device Name, platformName in APPIUM script.e.g:capabilities.setCapability("deviceName","Emulator"); capabilities.setCapability("platformName","Android");error:- Could not find adb. Please set the ANDROID_HOME environment variable with the Android SDK root directory path.Ans. You probably need to set up SDK root directory path in system 'Environment Variables' in 'Path' columnerror:- org.openqa.selenium.SessionNotCreatedException: A new session could not be created.Ans. You need to set a correct App path and restart the Appium server.

Page 14: Next level of Appium

www.tothenew.com

Advantages of Appium

Open Source Tool Support for both platforms iOS and android. Handles simulators/emulators and real devices Supports automation of hybrid, native and webApps Supports most of the programming languages like Java,

Ruby, Python, C# etc.

Page 15: Next level of Appium

www.tothenew.com

Dis-Advantages of Appium

Alert Handling is not implemented yet for native apps via Alert API

Appium supports Android Versions 17 or later . For lower versions we have to use Selendroid.

Lack of Image Recognition Limited Mobile Gesture Support.

Page 16: Next level of Appium

www.tothenew.com

Drawbacks and Limitations of Appium

Appium does not support testing of Android Version lower than 4.2

Limited support for hybrid app testing. eg: not possible to test the switching action of application from the web app to native and vice-versa.

No support to run Appium Inspector on Microsoft Windows.

Page 17: Next level of Appium

www.tothenew.com

Competitors of Appium

Some of the competitors of Appium are :- Ranorex Robotium SeeTest Jamo Solutions Test Complete

Page 18: Next level of Appium

www.tothenew.com

Tools Comparison Report

Page 19: Next level of Appium

www.tothenew.com

Questions

Page 20: Next level of Appium

www.tothenew.com

Conclusion:-

Page 21: Next level of Appium

www.tothenew.com

References:-

Page 22: Next level of Appium

www.tothenew.com

Click here to insert Web page

screenshot

Click Here to insert Logo

Page 23: Next level of Appium

www.tothenew.com

Client Location

Our Office

Email us at: [email protected]