The document discusses testing Android applications with Selendroid. It provides an overview of Selendroid, including its architecture and major components. It also covers how to set up and launch Selendroid, write tests with the Selenium API, and use the Selendroid Inspector tool to help develop tests.
Testing • A processof demonstrating that errors are not present ? OR • A way of establishing confidence that a program does what it is supposed to do ? OR • A means of achieving an error-free program by finding all errors ? A “DESTRUCTIVE”, yet creative process
4.
Testing Requirements Capture Analysis Test planning & ScenarioDesign Test Case Development Test Execution Test Result Analysis Test Cycle Closure Defect Fixing Cycle Defects New Version The Scenarios Design and the Test Case Development could normally start in parallel with the Development Cycle. Test Execution Synchs up with the Development Cycle during the functional Testing Phases
Mobile Testing –Challenges Devices – The biggest Mobile Testing challenge Diversity of the Mobile OSs and there flavors Diversity in Hardware Configuration Network related challenges Competitive market Change in market trend
8.
Automation & Frameworks Why Automation? Frameworks – Test Script Modularity • This can be achieved by creating small, independent scripts that represent modules, sections, and functions of the application-under-test and later can be combined in a hierarchical fashion to construct larger tests. Test Library Architecture • The test library architecture framework is very similar to the test script modularity framework but it divides the AUT into procedures and functions or objects and methods instead of scripts. Data-Driven Test Automation Framework • A data-driven framework is where test input and output values are read from data files (ODBC sources, CVS files, Excel files, ADO objects, and such) and are loaded into variables in captured or manually coded scripts.
9.
Automation & Frameworks Keyword-DrivenTest Automation Framework This requires the development of data tables and keywords, independent of the test automation tool used to execute them and the test script code that "drives" the AUT and the data. Hybrid Test Automation Framework The most commonly implemented framework is a combination of all of the above techniques, pulling from their strengths and trying to mitigate their weaknesses. The most successful automation frameworks generally accommodate both Keyword-Driven testing as well as Data-Driven scripts. This allows data driven scripts to take advantage of the powerful libraries and utilities that usually accompany a keyword driven architecture. The framework utilities can make the data driven scripts more compact and less prone to failure than they otherwise would have been.
10.
Introduction To selenium What is selenium? Selenium is a suite of tools to automate web browsers across many platforms. Portable software testing framework for web apps. Test can be written in Java, C#, Groovy, Perl, PHP, Python and Ruby. Tests can be executed on all modern browsers Platform Independent Open source software Latest release v2.44 (as on 23rd Oct 2014) Selenium extended to selendroid and ios-driver to automate mobile applications
1. Selenium IDE Helps you to develop Selenium test cases Easy to use firefox plug-in Supports record and playback Command , Target & Value Test Cases & test suites saved in “html” format Tests can be exported in other formats like java, C# , php etc using formatters.
2. Remote Control Selenium Remote Control (RC) is a test tool that allows you to write automated web application UI tests in any programming language against any HTTP website using any mainstream JavaScript-enabled browser. Selenium RC comes in two parts. A server which automatically launches and kills browsers, and acts as a HTTP proxy for web requests from them. Client libraries for your favorite computer language.
3. WebDriver Drivinga browser natively as a user would either locally or on a remote machine using the Selenium Server Selenium 1.0 + WebDriver = Selenium 2.0 WebDriver is designed in a simpler and more concise programming interface along with addressing some limitations in the Selenium-RC API.
20.
4. Selenium Grid Selenium-Grid allows you run your tests on different machines against different browsers in parallel. That is, running multiple tests at the same time against different machines running different browsers and operating systems. Selenium-Grid support distributed test execution. It allows for running your tests in a distributed test execution environment.
Introduction To Selendroid Selendroid is a test automation framework which drives off the UI of Android native and hybrid applications (apps) and the mobile web. Tests are written using the Selenium 2 client API - that's it! Selendroid can be used on emulators and real devices and can be integrated as a node into the Selenium Grid for scaling and parallel testing.
23.
Features of Selendroid Full compatibility with the JSON Wire Protocol/Selenium 3 Ready. No modification of app under test required in order to automate it Testing the mobile web using built in Android driver webview app Same concept for automating native or hybrid apps UI elements can be found by different locator types Gestures are supported: Advanced User Interactions API Selendroid can interact with multiple Android devices (emulators or hardware devices) at the same time Existing Emulators are started automatically Full integration as a node into Selenium Grid for scaling and parallel testing Multiple Android target API support (10 to 19) Built in Inspector to simplify test case development. Selendroid can be extended at runtime with your own extensions !
24.
Getting Started with Selendroid System Requirements Mac / Linux / Windows Java SDK (min 1.6) Set JAVA_HOME Latest Android-SDK http://developer.android.com/sdk/index.html Set ANDROID_HOME Android Virtual Device or Android Hardware Device Selendroid standalone server
25.
Selendroid Architecture Major Components Selendroid-Client - the java client library (based on the selenium java client). Selendroid-Server - that is running beside your app on the Android device. AndroidDriver-App - a built in Android driver webview app to test the mobile web. Selendroid-Standalone - manages different Android devices by installing the selendroid- server and the app under test.
26.
Selendroid-Server Selendroid-server isthe main component responsible for the app automation. The central driver class is DefaultSelendroidDriver. This class is responsible for doing the common activities (like taking screenshots) for both contexts NATIVE_APP and WEBVIEW The web view related driver class is SelendroidWebDriver and native class is SelendroidNativeDriver.
27.
Selendroid-Standalone Central driverclass is SelendroidStandaloneDriver that acts as a proxy between the selendroid-client and the selendroid-server Starts an Android emulator, creates for the app under test a customized selendroid- server and installs everything on the device. After the session is initialized on the device, subsequent requests are directly forwarded to the server on the device and the response routed back to the client.
28.
Getting an AUTready for automation Selendroid can be used to test already build apps. (.apk) The .apk file must be existing on machine where selendroid-standalone server will be stared. customized selendroid-server for the app under test (AUT) will be created Both apps (selendroid-server and AUT) must be signed with the same certificate in order to install the apks on the device
29.
Launching Selendroid Java–jar <<selendroidstandalone.jar>> –app <<myApp.apk>> java -jar selendroid-standalone-0.12.0-with- dependencies.jar -app selendroid-test-app-0.12.0.apk Selendroid-standalone will start a http server on port 4444 It will scan all AVDs that the user has created. The Android target version and the screen size will be identified. If an emulator is running, it can be used If there are Android hardware devices plugged in, they will also be added to the device store. Check application status on : http://localhost:4444/wd/hub/status.
30.
First Tests Inorder to create a new test session in the desired capabilities, the appId of the app under test must be provided in the format: io.selendroid.testapp:0.12.0. Based on that information a matching Android device will be identified, otherwise the test session will throw an error and not start After the found device has been initialized, a customized selendroid-server will be created and automatically installed on the device. The app under test will also be installed and the selendroid- server on the device will then be automatically started. After the test session has been successfully initialized, the test commands such as 'find an element' and 'element interactions' are routed to this device. If the test session has ended, the emulator will stop automatically
31.
Desired Capabilities (SelendroidCapabilities) Mandatoryproperties new SelendroidCapabilities( ... ): This requests an app for the test session without any preference about emulator or hardware device. SelendroidCapabilities.emulator( ... ): This requests an emulator and will fail the test session if no emulator is available. SelendroidCapabilities.device( ... ) This requests a hardware device and will fail the test session if no device is plugged in. SelendroidCapabilities.android( ... ) This starts a mobile web testing session.
32.
Desired Capabilities (SelendroidCapabilities) Fortesting native or hybrid apps: aut Specify the app id of the app under test (aut). E.g. io.selendroid.testapp:0.12.0 For testing Mobile Web: browserName Value must be android to start the 'Android driver webview app'.
33.
Desired Capabilities (SelendroidCapabilities) Optional Properties emulator If True, an emulator will be requested. If False, a hardware device will be requested. platformVersion Specify the Android target API version of the device. E.g. for KitKat it is: 19 locale Specify the locale of an emulator to be used in the test session. During the start the locale will be automatically configured. E.g. de_CH
34.
Desired Capabilities (SelendroidCapabilities) Optional Properties screenSize Specify the screen size of the device: e.g. 720x1280 display Specify the display number that is used to start the emulator on. Supported only in Linux platforms. E.g. 1 preSessionAdbCommands Specify a list of adb commands that will be executed on the target device before selendroid-server will be started. E.g. shell setprop name selendroid,
Selendroid Inspector Ithelps to inspect current state of app’s UI. http://localhost:4444/inspector Features View hierarchy View UI element properties UI screenshot with view locator Record the click actions Display the source html of a web view XPath helper
37.
Thank You … By Vikas Thange (Automation Testing consultant) vikasthange@gmail.com