• No results found

Enable Your Automated Web App Testing by WebDriver. Yugang Fan Intel

N/A
N/A
Protected

Academic year: 2021

Share "Enable Your Automated Web App Testing by WebDriver. Yugang Fan Intel"

Copied!
17
0
0

Loading.... (view fulltext now)

Full text

(1)

Enable Your Automated Web

App Testing by WebDriver

Yugang Fan

Intel

(2)

Agenda

• Background

• Challenges

• WebDriver

• BDD

• Behavior Driven Test

• Architecture

• Example

• WebDriver Based Behavior Driven Test

• Summary

(3)

Background

A web application is

any software that runs

in a web browser

. It is created in a

browser-supported programming language

(such as the combination of JavaScript,

HTML and CSS) and relies on a web browser

to render the application

For a web runtime,

web application is a

packaged app written in JavaScript, HTML,

CSS and so on

Crosswalk will be the default web runtime

on Tizen

app.cs s ….. Video. mp4 config .xml app.js index. html

(4)

Background

app.wgt

IVI

Wearable

… …

TV

Mobile

(5)

Challenges

Hard to apply image recognition or platform native UI automation solution to web

application

Multi-formity of web UI layout and elements requires a more convenient test

design and development method

Existing browser test automation techniques and tools have gap on support on web

applications or web runtime

(6)

WebDriver

http://www.w3.org/TR/webdriver/

: The WebDriver API is defined by a wire protocol

and a set of interfaces to

discover and manipulate DOM elements on a page

, and

to

control the behavior

of the containing browser from a

separate controlling

process

Most popular instance of WebDriver specification is

selenium2.0

: Chrome, Firefox,

IE, Opera, ……

More and more framework involve WebDriver to implement Web UI automation,

e.g. Watir WebDriver

(7)

WebDriver Support in Browsers

Remote End

XDriver

Selenium 2.0

WebDriver

API

Bindings

Local End

JSON over HTTP Wire Protocol Java Python Ruby C# Node.js …… URL Navigation Controlling Windows Elements Handling Screenshots Executing Javascript …… JSON over HTTP

(8)

WebDriver Support in Web Runtime

Host PC

Selenium 2.0

Crosswalk APP

Tizen Device

Crosswalk on Tizen

Xwalkdriver

Host PC

Selenium 2.0

Crosswalk APP

Crosswalk on Ubuntu

Xwalkdriver

(9)

BDD

Behavior-driven Development

An agile software development technique

that encourages

collaboration

between developers, QA and non-technical or business participants

in a

software project.

Our solution implements

BDD principles

to allow users to use tests written

in a

ubiquitous language style

to validate the web applications and web

platform and offers a

convenient and efficient way to develop, manage,

execute the test cases, and easy to combine with high level test

(10)

BDD Based Test

Feature: Calculator Demo Test Scenario: Check if 7*8=56 ?

When launch “calculator-test“ And I press “7" And I press “*” And I press “8" And I press “=“ BDD Test Cases

?

BDD Tool

Application

(11)

Architecture

“behave” —

Use a open source Python based BDD instance as the default BDD tool for

application test automation

BDD Test Cases

ATIP

Selenium 2.0

XDriver

Android Native

APIs

(e.g. UiAutomator)

Tizen Native

APIs

Crosswalk APPs

On Tizen

Crosswalk APPs

on Android

Browsers on multiple

platform

e.g. chrome/firefox

Android APPs and

System

Tizen

APPs and system

(12)

Example

BDD test cases *.feature file

Feature: Web Storage Test

Scenario: storage load page times When launch "w3c-webstorage-app" And I go to “test.html"

And I press "clear_button" And I reload

Then I should see "viewed this page 1 time(s)."

And I reload

And I reload

And I reload And I reload

Then I should see "viewed this page 5 time(s)."

ATIP steps

@step(u'I go to "{url}"') def i_visit_url(context, url):

assert context.app.switch_url(url, True) @step(u'I reload')

def reload(context):

assert context.app.reload() @step(u'I press "{key}"') def i_press(context, key):

assert context.app.press_element_by_key(key ………..)

ATIP low level implementations

def switch_url(self, url, with_prefix=True): if with_prefix:

url = urljoin(self.url_prefix, url) try:

self.__driver.get(url)

except Exception as e:

print "Failed to visit %s: %s" % (url, e) return False

return True

(13)

WebDriver Based Behavior Driven Test

xwalkdriver

Feature: Calculator Demo Test Scenario: Check if 7*8=56 ?

When launch “calculator-test“ And I press "seven"

And I press "mult" And I press "eight" And I press "equals“

Then I should see "56"

BDD Test Cases

Selenium 2.0 ATIP

(14)

Summary

Used by Crosswalk web tests automation and sample applications

test automation:

https://github.com/crosswalk-project/crosswalk-test-suite

Easy to be extended to any web application, browsers, web runtime

with WebDriver support.

(15)

Next Steps

• Support more pre-defined scenarios in ATIP

• Native and Hybrid application support in ATIP

• Multiple-application support in ATIP

• Support both BDD steps and Python APIs

• Adapt to W3C WebDriver specification update

(16)

Reference

https://github.com/crosswalk-project/crosswalk-test-suite/wiki/WebDriver-Based-Behavior-Driven-Test

https://github.com/crosswalk-project/crosswalk-test-suite

https://github.com/crosswalk-project/crosswalk-test-suite/tree/master/tools/atip

http://docs.seleniumhq.org/projects/

http://pythonhosted.org/behave/

(17)

References

Related documents

ing from the first third; PS 2, spine starting from the middle part; PS 3, spine starting from the last third of the penis; AS 1, short, straight spine; AS 2, short, bowed spine; AS

Warriors without this skill may still ride animals, but must test against their Leadership if hit by any missile, and at the beginning of any Combat phase when a standing enemy is

Furthermore, many signs indicate that the pharmaceutical industry – and in particu- lar the clinical research sector – will be relying on the help and support of freelancers more

•  Hadoop framework extensively used for scalable distributed.. processing of large

To develop a conceptual framework and a conceptual model which reflect the linkage between perceived neighbourhood environmental factors (food environment and built

a) Providers are instructed to send checks to Coordinated Disallowance, P.O. The checks are copied, deposited and forwarded to the IME by Wells Fargo Bank. The Core Unit scans

If an insurance company/surplus lines broker has not collected premiums for which a local government premium tax applies, the insurance company/surplus lines broker shall file an

plastid genome fragment with that of non-photosynthetic (Prototheca wickerhamii) and photosynthetic (Chlorella vulgaris) close relatives.. The sequenced regions are