mdc2011 android_ webdriver automation test

37
LOGO LOGO Tech propulsion Labs Android Webdriver Test automation - Selenium 2 Masud Parvez Email:[email protected]

Upload: masud-parvez

Post on 13-Apr-2017

177 views

Category:

Documents


3 download

TRANSCRIPT

Page 1: MDC2011 Android_ Webdriver Automation Test

LOGO

LOGO Tech propulsion Labs

Android Webdriver Test automation - Selenium 2

Masud Parvez

Email:[email protected]

Page 2: MDC2011 Android_ Webdriver Automation Test

All copyright is reserved by Tech propulsion labs

Contents

What is Selenium ?1

Selenium Versions2

Life of Web story3

Impact of JS4

Page 3: MDC2011 Android_ Webdriver Automation Test

Contents

Mobile application testing5

Android and Selenium 26

WebDriver7

Why Webdriver ?8

Page 4: MDC2011 Android_ Webdriver Automation Test

Contents

Android Test architecture9

Setup selenium for Android10

How are we doing?11

Limitations12

Page 5: MDC2011 Android_ Webdriver Automation Test

Contents

Demo13

Guide line for python14

Way to walk in the future with us15

16 Questions and Answers

Page 6: MDC2011 Android_ Webdriver Automation Test

What is selenium ?

Selenium is a suite of tools to automate web app(!!!!) testing across many platforms. Selenium runs in many browsers and operating systems.

Free wear

Page 7: MDC2011 Android_ Webdriver Automation Test

Selenium versions

Selenium 1

-----------------------------

Selenium 2 b-1

January

Selenium 2

July

2004 2008 2011 2011

Page 8: MDC2011 Android_ Webdriver Automation Test

Updates in Selenium 2

1 2 3 4

Mobile application testing .

Fire fox 4, 5, 6, 7

ExperimentalIE9 and chrome support

WebDriver

Page 9: MDC2011 Android_ Webdriver Automation Test

Why do we need Selenium?

?

?

?

?Selenium

Page 10: MDC2011 Android_ Webdriver Automation Test

Life before the Web

Total Application Market

Page 11: MDC2011 Android_ Webdriver Automation Test

Yesterday

Total Application Market

HTML +JS

Page 12: MDC2011 Android_ Webdriver Automation Test

Data

Total Application Market

Page 13: MDC2011 Android_ Webdriver Automation Test

Today

HTMLJS

Total Application Market

Page 14: MDC2011 Android_ Webdriver Automation Test

Tomorrow

HTML JS

Total Application Market

Page 15: MDC2011 Android_ Webdriver Automation Test

Today

HTMLJS

Total Application Market

Selenium Lives here

Page 16: MDC2011 Android_ Webdriver Automation Test

Tomorrow

HTML JS

Total Application Market

Selenium Lives here

Page 17: MDC2011 Android_ Webdriver Automation Test

Mobile application testing

1

iPhone/ iPad

2

Android

3

WP7

Page 18: MDC2011 Android_ Webdriver Automation Test

Android and selenium 2

Android driver

Page 19: MDC2011 Android_ Webdriver Automation Test

Webdriver

New tech that Selenium 2

Test direct access browser

No proxy server

New API

Page 20: MDC2011 Android_ Webdriver Automation Test

Why Webdriver ?

WebElement.findElement is universal - all UIs are trees Web has DOM (elements) Windows has HWND Android has Views

Page 21: MDC2011 Android_ Webdriver Automation Test

Why Webdriver ?

Many operations are universal between all UIsMatching:

clearclickfindElement(By.id)

Page 22: MDC2011 Android_ Webdriver Automation Test

Why Webdriver ?

Extensible API WebDriver API extensions, such as Rotatable, RenderedWebElement, are implemented by a subset of drivers.

Creating a new API for every platform is cumbersome instead: Emphasize the similarities with the core WebDriver API Supply simple platform-specific extensions as needed.

Facilitate piece-wise code re-usage

Page 23: MDC2011 Android_ Webdriver Automation Test

Android-Driver Interaction architecture

Page 24: MDC2011 Android_ Webdriver Automation Test

Setup selenium for Android

Phase 1 Phase 2 Phase 3

Set up EmulatorSet up SDK Start Emulator

Page 25: MDC2011 Android_ Webdriver Automation Test

Setup selenium for Android

Phase 4 Phase 5 Phase 6

Port ForwardingInstall the App Run your test

Page 26: MDC2011 Android_ Webdriver Automation Test

Download Android SDK

Web link: www. http://developer.android.com/sdk/index.html

Page 27: MDC2011 Android_ Webdriver Automation Test

Installation Command

Update SDK./android update sdk

Create Emulator./android create avd --target 2 --name newavd

Run emulator ./emulator.exe -avd newavd

Page 28: MDC2011 Android_ Webdriver Automation Test

Installation Command

Install android driver in emulator./adb install name_and

Forward port./adb forward tcp:8080 tcp:8080

If You are using eclipse then install ADT kit

Page 29: MDC2011 Android_ Webdriver Automation Test

Script

// Calling android driver AndroidDriver driver = new AndroidDriver();

// And now use this to visit Google driver.get("http://google.com"); // Find the text input element by its name WebElement element = driver.findElement(By.name("q"));

// Enter something to search for element.sendKeys("Tech Propulsion Labs");

Page 30: MDC2011 Android_ Webdriver Automation Test

Script

// Now submit the form. WebDriver will find the form for us from the element

element.submit(); // Check the title of the page System.out.println("Page title is: " + driver.getTitle());

//Turn off the driver driver.quit();

Page 31: MDC2011 Android_ Webdriver Automation Test

Limitations

Slower than Headless WebKit Driver Support for SDK versions 2.2 and prior, has been

deprecated Does not work on emulators running 2.3 because of

an emulator bug that should be fixed soon by Android. However it works on Devices running 2.3 and higher

Page 32: MDC2011 Android_ Webdriver Automation Test

DEMO

Page 33: MDC2011 Android_ Webdriver Automation Test

QUESTION

Page 34: MDC2011 Android_ Webdriver Automation Test

By python

To install the Python client library: # pip install -U selenium # Import the Selenium 2 namespace (aka "webdriver") from selenium import webdriver iPhone driver = webdriver.Remote(browser_name="iphone",

command_executor='http://172.24.101.36:3001/hub') Android driver = webdriver.Remote(browser_name="android",

command_executor='http://127.0.0.1:8080/hub') Google Chrome driver = webdriver.Chrome() Firefox driver = webdriver.Firefox()

Page 35: MDC2011 Android_ Webdriver Automation Test

Way to walk in the future with us

Blog: www.masudparvez.weebly.com/blog

Post in blog regarding this topic

http://masudparvez.weebly.com/1/post/2011/08/andriod-webdriver-want-to-test.html

Page 36: MDC2011 Android_ Webdriver Automation Test

Way to walk in the future with us

Android .apk Automation Test link: http://www.youtube.com/watch?

v=yi6Z3l0ci1o&feature=mfu_in_order&list=UL

Selenium automation framework Link: http://www.youtube.com/watch?

v=wpudDb3ECPA&feature=mfu_in_order&list=UL

Page 37: MDC2011 Android_ Webdriver Automation Test

Copyright 2011 Tech Propulsion Labs, Inc.

Masud ParvezSQA Architect

Email: [email protected]