• Share
  • Email
  • Embed
  • Like
  • Save
  • Private Content
Mobile WebAutomation using Selenium2.0
 

Mobile WebAutomation using Selenium2.0

on

  • 3,882 views

 

Statistics

Views

Total Views
3,882
Views on SlideShare
3,864
Embed Views
18

Actions

Likes
2
Downloads
106
Comments
0

1 Embed 18

http://udayhere.wordpress.com 18

Accessibility

Categories

Upload Details

Uploaded via as Microsoft PowerPoint

Usage Rights

© All Rights Reserved

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Processing…
Post Comment
Edit your comment
  • 10/26/12 Confidential © 2008 Wipro Ltd
  • Confidential © 2008 Wipro Ltd 10/26/12

Mobile WebAutomation using Selenium2.0 Mobile WebAutomation using Selenium2.0 Presentation Transcript

  • Mobile Web Automation using Selenium2.0 By B.K.Venkata.UdayKumar
  • Contents :1. Theme of Presentation.2. What is Selenium 2.0 ?3. How Selenium 2.0 works for Mobile Web ?4. Other Tools and Framework5. Approach of using Selenium2.06. Test Environment Setup7. Advantages and Disadvantages8. Demo9. References
  • Theme oF PresentationThe main theme of this Presentation is Mobile Web functional testautomation with special stress on selenium suite of tools,frameworks, methodologies and approach.How would you automate functional tests and still run fromcommand line or from Emulator and Real Device?Sounds interesting right? This is our Selenium2.0+TestNG+Antframework
  • Selenium 2.0•Selenium, is an open Source tool from OpenQA.•The tool is considered to be one of the best tools available in the marketto automate the web applications testing.•Selenium offers quick and powerful way to write functional tests forapplications and an environment where they can be run across differenthosts.•One of Selenium’s key features is the support for executing one’s tests onmultiple browser platforms.
  • Selenium 2.0 Vs Selenium 1.0Selenium 2.0 Selenium 1.0Selenium 2 is the future direction of the project and the Selenium RC was the main Selenium project for a longnewest addition to the Selenium toolkit. time.Mobile Application Testing is Supported. Mobile Application Testing is not supported.It supports the Web Driver API and underlying Selenium 1 is still actively supported and provides sometechnology, along with the Selenium technology features that may not be available in Selenium 2 for a while, including support for several languages and support for almost every browser out there.Selenium web driver makes direct calls to the browser It works with Java Script and requires Seleium server tousing each browser native support for automation. inject the script into the browser and to then translate message from your test programs language specific selenium client library into commands that invoke the java script commands which in turn automate the AUT from within the browser
  • How Selenium 2.0 Works for Mobile Web(Android Devices) ?1. The Android Driver uses the RemoteWebDriver.2. The client side is your test code(Java Code).3. The server side is an application that gets installed on the android emulator or device.(android-server.apk)4. The client and the server communicate using the Wire Protocol which consists of REST requests using JSON over HTTP.5. The application executes the tests in the context of an Android Web View.
  • How Selenium 2.0 Works for Mobile Web Web(Android Devices) ?Step 1:Install Android SDKStep 2:Set up the Emulator or Android Device.Step 3:Install the Android WebDriver Application using the command adb -s <serialId> -e install -r android-server.apkStep 4: Setup Port Forwarding using the command adb -s <serialId> forward tcp:8080 tcp:8080Step 5:Start the Web Driver server on the Emulator or Android device.Step 6:Run the Test Script.
  • Other Tools and FrameworkTools and Purpose and FunctionUtilitiesTest NG 1. TestNG is a framework that makes data-driven testing possible in selenium. 2. This framework is used to organize different tests, and to report results. 3. TestNG is a testing framework created in line with Junit but with added features that makes it suitable for use in regression test automation projects. 4. Data Provider is one such feature in testing; it allows a test method to be executed with multiple sets of data.ANT 1. Apache Ant is a Java library and command-line tool whose mission is to drive processes described in build files as targets and extension points dependent upon each other. 2. The main known usage of Ant is the build of Java applications. 3. Ant provides the glue to hold everything together, and execute basic commands.
  • An Approach of Using Selenium2.0 Integration of Selenium2.0 with TestNG and ANT. This framework is created using ANT, TestNG and Selenium 2.0. Through this framework, an user will be able to create an automated test case that can be executed in a single command. Parameters Appending Selenium2.0+ values TestNG Script Mobile Web Returns Result Report Results to a File Temp Folder Report_Template.xls Reports.xls(*)+TestNG Report ANT
  • Test Environment Setup
  • Test Environment Setup(Software and Hard Ware) Server/Computer Mobile Device  Java SDK1.5 and above  Android Device  If using python, then Python 2.7  Inbuit Mobile Broswer or any  Eclipse IDE supported browser  Ant or Maven for build integration  android-server-2.16.apk  Selenium2.0-selenium-java-2.16.1.zip (http://code.google.com/p/selenium/d (http://code.google.com/p/selenium/d ownloads/detail?name=android- ownloads/list) server-2.16.apk&can=2&q=)  Test  Accessibility to Internet. Ng(http://testng.org/doc/download.ht ml) for reporting if using java  Internet connection
  • Advantages and Disadvantages Advantages : Runs in Android browser Uses native touch events to emulate user interaction Runs on emulator and device Supports multiple languages(Java,Python,c#,perl) Disadvantages :• The driver is unlikely to work reliably on these versions. There were several limitations, for instance XPath wasnt supported natively and the Android Driver used to inject an Xpath library in WebView.
  • DEMO The Mobile Web Site used is: https://xxx.xxx.comDevelopment of Script:Using java:Using python:Prerequisite: For Java For Python Java SDK 1.5 and above Python 2.7 and above  android-server.apk Python bindings(use easy_install selenium ) Selenium2.0
  • Script: using Javaimport org.openqa.selenium.By;import org.openqa.selenium.WebElement;import org.openqa.selenium.android.AndroidDriver;public class OneTest extends TestCase {  public void testScript() throws Exception {    WebDriver objDriver = new AndroidDriver();      // visit XXX.XXX.com site    objDriver.get("http://xxx.xxx.com");         // Check the title of the page    System.out.println("Page title is: " + objDriver.getTitle());    objDriver.quit();}}
  • Script: using pythonfrom selenium import webdriverobjDriver = webdriver.Remote(browser_name="android", command_executor=http://127.0.0.1:8080/hub)objDriver.get(“xxx.xxx.com”)objDriver.close()
  • References: http://code.google.com/p/selenium/wiki/AndroidDriver http://seleniumhq.org/docs/01_introducing_selenium.html
  • Thank You