tellurium 0.7.0 presentation

39
Tellurium 0.7.0 Jian Fang @telluriumsource.org

Upload: johnjianfang

Post on 30-May-2015

1.582 views

Category:

Technology


4 download

DESCRIPTION

Tellurium 0.7.0 features introduction.

TRANSCRIPT

Page 1: Tellurium 0.7.0 presentation

Tellurium 0.7.0

Jian Fang @telluriumsource.org

Page 2: Tellurium 0.7.0 presentation

Outline Tellurium Overview Deep Dive into Tellurium Tellurium Advanced Topics Summary

Page 3: Tellurium 0.7.0 presentation

Part I: Tellurium Overview

Page 4: Tellurium 0.7.0 presentation

What is Tellurium? Tellurium Automated Testing Framework is an

automated web testing framework grew up from the Selenium framework with different focuses.

Focus on a group of UI elements, i.e., widget Expressiveness Test robust Dynamic web context Easy to Maintain

Page 5: Tellurium 0.7.0 presentation

Why Tellurium is Novel Most existing frameworks focus on individual UI

elements Tellurium treat the group of elements as a whole

(called a UI module)

Page 6: Tellurium 0.7.0 presentation

How Challenges are addressed in Tellurium

Expressiveness

Groovy DSLs UI definition, actions, data access, and test support

Test Robust

Do not define locators directly dynamically generate runtime locators from UI

attributes. Partial UI module matching in new Tellurium

Engine

Page 7: Tellurium 0.7.0 presentation

How Challenges are addressed in Tellurium (Cont'd)

Dynamic Web Content UI templates for Data Grids such as List and

Table UID Description Language (UDL) represents

dynamic factors in UI modules respond attribute for JavaScript events

Easy to Maintain No hard-coded locators in test code Separation of UI definition and test code UI Module class for UI definition and UI

methods

Page 8: Tellurium 0.7.0 presentation

Tellurium Main Features Abstract Groovy UI objects to encapsulate web UI elements

UI modules and widgets for structured test code and re-usability

DSL for UI definition, actions, data access, and testing

Dynamically generate runtime locator to localize changes

UI templates for dynamic web contents

CSS selector is the default locator

Macro command bundles multiple API calls to reduce round trip overhead

UI module group locating and caching for test robust and better speed

UID Description Language makes it easy to represent dynamic factors in UI module

New jQuery-based testing driving Engine

Data driven testing support

Page 9: Tellurium 0.7.0 presentation

Tellurium Sub-projects Engine: New test driving engine with UI

group locating, CSS selector, and command bundle

UDL: UID Description Language Parser

Core: DSL, APIs, object to runtime locator mapping, and test support

Widgets: Dojo and ExtJS widgets

Trump: Tellurium UI module firefox plugin

Maven Archetypes: create tellurium projects with Maven

Reference projects: Tellurium examples

Page 10: Tellurium 0.7.0 presentation

Tellurium History

Prototyped in June 2007 Open sourced in June 2008 Latest release 0.7.0 in May 2010

Page 11: Tellurium 0.7.0 presentation

Tellurium Architecture

Tellurium Core: Object to runtime locator mapping, event handling, and command bundling

Tellurium Engine: Testing driving, group locating and UI module caching

Page 12: Tellurium 0.7.0 presentation

How Tellurium Works: Selenium Wrapper

Tellurium Core generates runtime locator and then call Selenium APIs

Page 13: Tellurium 0.7.0 presentation

How Tellurium Works: Tellurium Way

UI module group locating and caching in Engine Tellurium new APIs

Page 14: Tellurium 0.7.0 presentation

How to Obtain Tellurium Download Tellurium 0.7.0 Release tar ball

http://aost.googlecode.com/files/tellurium-0.7.0.tar.gz

Create Tellurium Maven project with tellurium-junit-archetype or tellurium-testng-archetype

mvn archetype:create -DgroupId=your_group_id -DartifactId=your_artifact_id \

-DarchetypeArtifactId=tellurium-junit-archetype \

-DarchetypeGroupId=org.telluriumsource -DarchetypeVersion=0.7.0 \

-DarchetypeRepository=http://maven.kungfuters.org/content/repositories/releases

Page 15: Tellurium 0.7.0 presentation

How to Use Tellurium

Create Tellurium test project Create UI modules Create Test cases

Page 16: Tellurium 0.7.0 presentation

Part II: Deep Dive into Tellurium

Page 17: Tellurium 0.7.0 presentation

UI Module Explicitly shows what UI you are testing UI module represents a composite UI object in the format of

nested basic UI elements. UI module definition is expressive, for example:ui.Container(uid: "GoogleSearchModule", clocator: [tag: "td"], group: "true"){

InputBox(uid: "Input", clocator: [title: "Google Search"])

SubmitButton(uid: "Search", clocator: [name: "btnG", value: "Google Search"])

SubmitButton(uid: "ImFeelingLucky", clocator: [value: "I'm Feeling Lucky"])

}

UI module class includes UI methods Tellurium core automatically generates runtime locator from the

clocators in UI module

Page 18: Tellurium 0.7.0 presentation

UI Object Identifier

UI object Identifier (UID) is used to reference UI objects in UI module

Each object's UID is a cascade of its ancestors' ids and its own id

List and Table elements can be referenced by indices or ids

UID removes the need to reference locators directly in test code.

type "GoogleSearchModule.Input", "Tellurium test"

click "GoogleSearchModule.Search"

Page 19: Tellurium 0.7.0 presentation

Composite Locator Composite Locator, i.e., clocator, is a set of UI

attributes used to describe a Web UI element Groovy class definition is as followsclass CompositeLocator {

String header

String tag

String text

String trailer

def position

Map<String, String> attributes = [:]

}

Tellurium Core automatically generates the runtime locator, either xpath or css selector, from the clocator

Page 20: Tellurium 0.7.0 presentation

Group Locating

The main idea of group locating is to use the relationship among UI objects in the UI module to locate them.

Instead of “find the Form on the web” Consider “find the Form whose children include two Inputs and

one selector” The Santa algorithm locates the UI module as a whole

Page 21: Tellurium 0.7.0 presentation

UI Templates UI templates are used to describe

Unknown number of UI elements, but the types are known

Many and similar UI elements List and Table objects use UI templates UDL defines the grammar of UI template

definition. ui.Table(uid: "issueResult", clocator: [id: "resultstable"]) {

UrlLink(uid: "{header: any} as Extra", clocator: [text: "*..."])

TextBox(uid: "{row: all, column -> Extra}", clocator: [:])

UrlLink(uid: "{row: all, column: all}", clocator: [:])

}

Page 22: Tellurium 0.7.0 presentation

Tellurium UI Object UI objects are an abstraction of the web UI elements. UI object main attributes:

uid: identifier in UDL syntax namespace: for XHTML locator:

clocator: Object attributes base locator: predefined xpath or CSS selector

group: group locating option respond: JavaScript events

ui.Table(uid: "issueResult", clocator: [id: "resultstable", class: "results"], group: "true")

Page 23: Tellurium 0.7.0 presentation

Tellurium Predefined Objects

Page 24: Tellurium 0.7.0 presentation

Tellurium Widgets Tellurium provides you the capability to group UI objects into a

widget object and then you can use the widget directly just like using a tellurium UI object.

Reusable

Name space to avoid name collision

Compiled as a jar file

Load from Tellurium configuration file Tellurium provides an onWidget method to call widget methods.

Example: Dojo Datepicker. ui.Form(uid: "dropdown", clocator: [:], group: "true"){

Image(uid: "selectDate", clocator: [title: "select a date", alt: "date"])

DOJO_DatePicker(uid: "datePicker", clocator: [tag: "div", dojoattachpoint: "subWidgetContainerNode"])

}

onWidget "dropdown.datePicker", selectPrevYear

Page 25: Tellurium 0.7.0 presentation

Domain Specific Language The DSL is the heart of the Tellurium and all UI module

classes must extend the DslContext class Defines DSL expression, for instance, “click uid” DSL context includes

UI object definitions event actions data access Test support

DslContext is extended to support Data Driven Testing, which includes input file layout, test definition, and testing flow.

Page 26: Tellurium 0.7.0 presentation

Tellurium Test Support Test Cases

Tellurium Groovy Test Case

Tellurium JUnit Test Case (JUnit 4 annotations)

Tellurium TestNG Test Case (TestNG annotations)

Pure DSL Script

Data Driven Testing

Separate test data from test script Data providers UI module, input file layout, test definition Test flow control

Page 27: Tellurium 0.7.0 presentation

Tellurium UI Module Plugin Trump is a Firefox

plugin to automatically generate UI modules

Record user clicks and then generate UI module

Can export to a Groovy file

Page 28: Tellurium 0.7.0 presentation

How Trump Works

Record user clicks Generate UI module Customize UI module Validate UI module

Page 29: Tellurium 0.7.0 presentation

Demo

Page 30: Tellurium 0.7.0 presentation

Part III: Tellurium Advanced Topics

Page 31: Tellurium 0.7.0 presentation

Marco Command

Bundle a set of API calls into one call Processed by the bundle processor in Tellurium Core

automatically Tellurium Engine decodes and runs each API call Reduce round trip overhead to Tellurium Engine

Page 32: Tellurium 0.7.0 presentation

Santa Algorithm

Santa algorithm is used to locate the whole UI module

Basically a branch and trim search procedure on the runtime DOM

Multiple match reduction mechanism: Mark

Look Ahead

Look Id

Best Effort

Relax: partial match with a match score

Page 33: Tellurium 0.7.0 presentation

UID Description Language

UDL grammars define the UIDs for different types of UI objects UI objects without UI templates

List

Table

ID: starts with a letter and is followed by digits, letters, and "_"

Index includes “first”, “last”, “any”, “odd”, “even”, “all”, and digits

Routing: rtree and rgraph

Page 34: Tellurium 0.7.0 presentation

UI Module Caching UI module is converted into a JSON object

Santa algorithm locates the UI module

UI module is cached for later access

Caching can be turned on and off by the call void useCache(boolean isUse)

Cache eviction policies Discard old

Discard new

Discard least used

Discard invalid

Get Cache usage Map<String, Long> getCacheUsage()

Page 35: Tellurium 0.7.0 presentation

Internationalization Support Provides support for internationalization of

strings and exception messages. I18n support is provided by message bundle Set locale in Tellurium configuration filei18n{

locales = "en_EN"

}

Page 36: Tellurium 0.7.0 presentation

Powerful Utilities Show the generated runtime

locators

void dump(String uid)

Diagnose UI definitionvoid diagnose(String uid)

Validate UI modulevoid validate(String uid)

UI Module partial matchvoid useClosestMatch(boolean isUse)

Turn on and off Tellurium Engine Log

void useEngineLog(boolean isUse)

Get runtime HTML sourcevoid getHTMLSource(String uid)

Visualize UI module void show(String uid, int delay)

Turn on and off execution time trace

void useTrace(boolean isUse)

Page 37: Tellurium 0.7.0 presentation

Part IV: Summary

Page 38: Tellurium 0.7.0 presentation

Future Directions Finish up jQuery-base Tellurium APIs Tellurium widget improvement Trump upgrade to automatically generate testing

DSL script Testing workflow support Behavior driven testing support Tellurium as a cloud testing tool Tellurium as a web security testing tool IDE and other plugins

Page 39: Tellurium 0.7.0 presentation

Resources Tellurium Project Site

http://code.google.com/p/aost/

Tellurium on twitter

http://twitter.com/TelluriumSource

TelluriumSource

http://telluriumsource.org

Tellurium user group

http://groups.google.com/group/tellurium-users

Tellurium 0.7.0 Release tar ball

http://aost.googlecode.com/files/tellurium-0.7.0.tar.gz

Tellurium 0.7.0 Reference Documentation

http://aost.googlecode.com/files/tellurium-reference-0.7.0.pdf