SlideShare une entreprise Scribd logo
1  sur  108
Télécharger pour lire hors ligne
Tellurium: A New Approach for Web
              Testing

   Jian Fang (John.Jian.Fang@gmail.com)
 Vivek Mongolu (vivekmongolu@gmail.com)
    Matt Senter (matt.senter@gmail.com)
 Haroon Rasheed (haroonzone@gmail.com)
      Quan Bui (Quan.Bui@gmail.com)
     Mikhail Koryak (koryak@gmail.com)
Outline

 Motivations



Overview


Introduction


Examples and Demo


Future Directions


Resources
What’s Wrong with Selenium




• Take Tellurium project web site as an example.
    – The above UI includes one basic search module
       and one advanced search module
    – Use Selenium IDE and it generates the following
       Selenium test case
Example Selenium Test case

selenium.open(quot;/p/aost/issues/advsearchquot;);
selenium.select(quot;//div[@id='maincol']/form/table/tbody/tr[1]/td[3]/selectquot;, quot;label=regexp:sAll Issuesquot;);
selenium.type(quot;wordsquot;, quot;Telluriumquot;);
selenium.type(quot;withoutquot;, quot;corequot;);
selenium.click(quot;btnquot;);
selenium.waitForPageToLoad(quot;30000quot;);
...
Assertions
...
selenium.open(quot;/p/aost/issues/advsearchquot;);
selenium.select(quot;canquot;, quot;label=regexp:sAll Issuesquot;);
selenium.type(quot;qquot;, quot;Telluriumquot;);
selenium.click(quot;//input[@value='Search']quot;);
selenium.waitForPageToLoad(quot;30000quot;);
...
Assertions
...
What do you observe?
• Verbose
     – “Selenium.” everywhere
     – Locators everywhere
• Not expressive
     – Can you see what the UI looks like?
     – Can you tell what the UI element that the locator
        is associated with?
• Coupling
     – UI locators, actions, and assertions are coupled
        together
• Fragile
     – Look at the xpath
        //div[@id='maincol']/form/table/tbody/tr[1]/td[3]/select
•

     – What if the div or the table portions are changed?
•
What do you observe? (Cont’d)
• Record and Play
    – Need to cover all testing scenarios
    – How about data dependency?
    – What if the UI is changed?
• Refactor
    – Seems to be difficult, especially if you are not the
       person who wrote the tests.
• Reusable
    – Less likely
• Any way to handle dynamic factors on the web?
    – Dynamic data such as data grid and list of options
    – Javascript events
How about Canoo WebTest
                                                                          • Canoo WebTest is an Open
                                                                              Source tool for
                                                                              automated testing of web
import com.canoo.webtest.WebtestCase

                                                                              applications
class SimpleTest extends WebtestCase {


                                                                          • Test cases in XML or
    void testWebtestOnGoogle() {

                                                                              Groovy
        webtest(quot;check that WebTest is Google's top 'WebTest' resultquot;)
{

                                                                          • Use HtmlUnit as testing
            invoke quot;http://www.google.comquot;, description: quot;Go to Googlequot;
                                                                              driving engine
            verifyTitle quot;Googlequot;
                                                                          • Same problems as
                                                                              Selenium
            setInputField name: quot;qquot;, value: quot;WebTestquot;

            clickButton quot;I'm Feeling Luckyquot;
                                                                                   Individual UI
                                                                               –
            verifyTitle quot;Canoo WebTestquot;
                                                                                   Not robust
                                                                               –
        }
                                                                                   Not reusable
                                                                               –
    }
                                                                                   Test code couple with UI
                                                                               –
}
                                                                          •
What Else?
• Twill is a simple language that allows users to browse
   the Web from a command-line interface
     – open source and written in Python
     – use link, forms, cookies, and most standard Web features
     – has a simple Python interface
• Disadvantages
         Deal with individual UI
     –
         Need to parse html interactively, not convenient to use
     –
         Only support Python
     –
         Simple, not powerful
     –

            setlocal query quot;twill Pythonquot;
            go http://www.google.com/
            fv 1 q $query
            submit btnI     # use the quot;I'm feeling luckyquot; button
            show
Motivations



 Robust to changes



Easy to refactor


Reusable


Expressive


Easy to use


Address dynamic factors


    – Dynamic data
    – Dynamic web context
    – Javascript events
       –

    Propose: Tellurium Automated Testing Framework


                      (Tellurium)
Outline

 Motivations



Overview


Introduction


Examples and Demo


Future Directions


Resources
What is Tellurium?
• Tellurium is a UI module based web testing framework
• Tellurium is built on top of Selenium at the current
    stage
      – May have our own tellurium test driving engine in
          the future
• Tellurium is implemented in Groovy and Java
• Tellurium includes a set of Domain Specific Languages
    (DSLs) to define UI, actions, and tests
• Tellurium handles the mapping from Java object to UI
• Tellurium provides you the capability to write tests in
      – Java (JUnit 4 or TestNG)
      – Groovy
      – Pure DSL script
• Tellurium supports Data Driven Testing
What Tellurium looks like?



                 • (I) Basic Search Module

ui.Form(uid: quot;issueSearchquot;, clocator: [action: quot;listquot;, method: quot;getquot;], group: quot;truequot;) {
   TextBox(uid: quot;searchLabelquot;, clocator: [tag: quot;spanquot;])
   Selector(uid: quot;issueTypequot;, clocator: [name: quot;canquot;, id: quot;canquot;])
   InputBox(uid: quot;searchBoxquot;, clocator: [name: quot;qquot;])
   SubmitButton(uid: quot;searchButtonquot;, clocator: [value: quot;Searchquot;])
}
What Tellurium looks like? (Cont’d)




                     • Advanced Search Module

ui.Form(uid: quot;issueAdvancedSearchquot;, clocator: [action: quot;advsearch.doquot;, method: quot;postquot;],
group: quot;truequot;)
{
       Table(uid: quot;searchTablequot;, clocator: [class: quot;advqueryquot;]){
          Selector(uid: quot;row:1, column: 3quot;, clocator: [name: quot;canquot;])
          SubmitButton(uid: quot;row:1, column:4quot;, clocator: [value: quot;Searchquot;, name: quot;btnquot;])
          InputBox(uid: quot;row:2, column:3quot;, clocator:[name: quot;wordsquot;])
          InputBox(uid: quot;row:3, column:3quot;, clocator:[name: quot;withoutquot;])
       }
 }
What Tellurium looks like? (Cont’d)
public void selectIssueType(String type){
  selectByLabel quot;issueSearch.issueTypequot;, type
}
public void searchIssue(String issue){
  keyType quot;issueSearch.searchBoxquot;, issue
  click quot;issueSearch.searchButtonquot;
  waitForPageToLoad 30000
}
public void advancedSearchIssue(String issueType, String words, String without){
  if(issueType != null){
      selectByLabel quot;issueAdvancedSearch.searchTable[1][3]quot;, issueType
  }
    if(words != null){
       keyType quot;issueAdvancedSearch.searchTable[2][3]quot;, words
    }
    if(without != null){
       keyType quot;issueAdvancedSearch.searchTable[3][3]quot;, without
    }

    click quot;issueAdvancedSearch.searchTable[1][4]quot;
    waitForPageToLoad 30000
}



                     Methods defined for UI modules
How challenges are addressed in
             Tellurium
• No longer “record and play” style, but UI module
   oriented
     – defining nested UI objects and methods as a UI module
          class, write your own test cases as many as you like
          based on the UI module class.
• Decoupling
     – UI and tests are separated
     – UI is defined in a Groovy UI module class
     – Write your own test cases in Java, Groovy, or DSL scripts
• Robust to changes
     – Composite locator (UI element attributes) is used to
          define UI and the actual xpath will be generated at
          runtime, i.e., different attributes -> different runtime
          xpath. UI module internal changes are addressed.
     – Group locating is used to remove the dependency of the
          UI objects from external UI elements, i.e., external UI
          changes will not affect the current UI module for most
          cases.
How challenges are addressed in
              Tellurium
• Easy to refactor
     – Refactor the individual UI module class
• Reusable
     – UI module class could be re-used for the same
        application
     – Tellurium Widgets can be re-used for different
        applications
• Expressive
     – UI module is straightforward
     – Groovy syntax
     – DSLs for actions and tests
• Dynamic factors on web
     – UI templates for data grid or List of dynamic data
     – “respond” attribute in UI object for Javascript events
     – “Option” UI object for multiple possible UI patterns
How challenges are addressed in
             Tellurium
• Easy to use
    – Tellurium provides a configuration file for you to
       wire in your own new UI objects/widgets and
       customize the framework
    – Test can be written in
          • Java
          • Groovy
          • Pure DSL script
    – Support JUnit 4 and TestNG
    – Reference projects are provided to guide users
       on how to use Tellurium
    – Support ant and Maven build
• Data Driven Testing
Outline

 Motivations



Overview


Introduction


Examples and Demo


Future Directions


Resources
Why Tellurium is A NEW Approach?

• Tellurium comes with a set of new concepts that
   make Tellurium a different and new approach
   for Web Testing
    –   UI Module
    –   UID
    –   Composite Locator
    –   Group Locating
    –   UI Template
New Concepts: UI Module
 Tellurium Automated Testing Framework is UI


module based
    – UI module is a collection of UI elements you
       group them together
    – UI module represents a composite UI object in
       the format of nested basic UI elements
    – The UI elements inside the composite UI object
       have relationship to each other, i.e., logically or
       to be on the same subtree on the DOM
    – For each UI modules, you need to define a set of
       methods to act on the UI
New Concepts: UID
                              Form: “A”         “A”




                                     Container: “C”      “A.C”
            InputBox: “B”
    “A.B”




                             Selector: “D”            List: “E”
                 “A.C.D”                                            “A.C.E”




                                          UrlLink: “1”            InputButton: “n”
                            “A.C.E[1]”                                               A.C.E[n]

 Each UI object has a UID and is referenced by cascading UIDs




 Elements in List and Table are referenced by indexes




 UID makes Tellurium less verbose and more expressive

New Concepts: Composite Locator
 Composite Locator (clocator): A set of attributes used to define


the object and the actual locator will be derived automatically at
run time. For example,
    SubmitButton(uid: quot;googlesearchquot;, clocator: [name: quot;btnGquot;, value: quot;Google Searchquot;])





     Which is equal to the following runtime xpath:



    /input[@name=”btnG” and @value=”Google Search”]





     The class definition is as follows,



 class CompositeLocator {




–String header
–String tag
–String text
–String trailer
–def position
–Map<String, String> attributes = [:]

 }





 Each clocator will generate a run time relative xpath and it


makes Tellurium robust to changes inside UI module.
New Concepts: Group Locating




 Usually XPath only includes one path to the target node,


for example, “/div/div/form/input”, that is to say, only
information along this path is used.
 We can use information in the nested object such as the


whole form in Fig (B), i.e., “A Form whose children are
input (attributes), selector (attributes), and
input(attributes)”
New Concepts: Group Locating
               (Cont’d)
 The composite object has a reference point and once the


reference point is determined, the other UI elements can be
located by their relations to the reference point. Usually the
top level element is the reference point.
  The quot;groupquot; attribute is used to turn on the group locating if


it is true. Please see the example of “downloadSearch”
Form.
 By using group locating, the information defined in the UI


module itself is enough for you to locate all UI objects in that
UI module and your UI module does not depend on the UI
elements outside. For example, in the example, your Form
object does not depend on the two outside divs, which
makes Tellurium robust to outside changes.
New Concepts: Group Locating
                (Cont’d)
    Scenarios


I.At least one of the UI element can be located by its own, for
instance, the Selector node, then the Form node and other nodes
can be located by their relative position to that UI element.
II.One element itself cannot be located alone, but multiple
element can be located jointly. For example, you cannot locate
the inputs node alone, but you can locate the Form with children:
two inputs, one selector.
III.The information inside the UI module are not enough to locate
them. You can either create another UI module to include more
elements, or you have to use some information from outside.
 From our experience, most likely you will have scenario (I)


and (II).
Right now, Tellurium exploits one level of information, i.e.,

the attributes of the direct children of the reference point. In
the future, the Locator Query Language (LQL) will exploit
more information.
New Concepts: UI Template
 UI template can be used for



      – Unknown number of UI elements, but the types are
          known
      – Many and similar UI elements
Tellurium List and Table objects use UI templates to define

the UI elements they include inside.

    List(uid: quot;subcategoryquot;, clocator: [tag: quot;divquot;, class:quot;sub_cat_sectionquot;]){
         TextBox(uid: quot;2quot;, clocator: [tag: quot;divquot;, class: quot;sub_cat_titlequot;])
          Container(uid: quot;allquot;, clocator: [tag: quot;pquot;]){
               UrlLink(uid: quot;linkquot;, clocator: [:])
          }
    }

    Table(uid: quot;searchTablequot;, clocator: [class: quot;advqueryquot;]){
         Selector(uid: quot;row:1, column: 3quot;, clocator: [name: quot;canquot;])
         SubmitButton(uid: quot;row:1, column:4quot;, clocator: [value: quot;Searchquot;, name: quot;btnquot;])
         InputBox(uid: quot;row:2, column:3quot;, clocator:[name: quot;wordsquot;])
         InputBox(uid: quot;row:3, column:3quot;, clocator:[name: quot;withoutquot;])
    }
Do you need to know Groovy ?
    Groovy is a dynamic language for Java


            Compatible with Java syntax
        –
            Object oriented
        –
            More expressive
        –
            MetaClass for meta programming
        –
            Gstring: “label=${target}”
        –
            Closure
        –
            Optional type
        –
 Tellurium Core is implemented in Groovy and your UI


module class must be a Groovy class.
But Test cases can be written in Java, Groovy, or pure DSL

scripts.
You do not really need to know Groovy when use Tellurium

        – UI definition is descriptive using DSL
        – Methods for UI module can be written in Java syntax
        – But using Groovy features will make your code more concise
 Groovy IDE support (Eclipse, Netbeans, IntelliJ)

Tellurium Architecture
UI Object
 UI Object includes


      – uid: should be unique inside a UI module and the top
          level uids should be different for different UI modules.
      – namespace: for future extension
      – locator: the locator of the UI object, could be
             • A base locator (relative xpath)
             • A composite locator (object attributes)
      – group: this option only applies to a collection type of UI
          object such as Container, Table, List, and Form. If
          quot;groupquot; attribute to be true, group locating feature will
          turn on
      – respond: define what JavaScript events the UI object
          could respond to.
•UI objects are held on an object registry, which consists of
multiple object trees.
Object Builder
 Object Builders are used to build the objects,


which are usually used by the framework itself.
Users are unlikely to use them directly.
The builders utilize the ability to instantiate a

groovy object by passing object attributes in a
map. They also use the groovy Closure so that
the framework can customize the building
procedure.
The builders are heavily used by the DSL object

parser to create UI objects from DSL on the fly.
Object Builder Registry
 The object builder registry is designed so that the user can


add custom UI objects to the DSL context.
 Users can add new UI object builders to the object builder


registry by calling the following methods directly,
    •   registerBuilder(new_name, new_builder)

  Or specify new UI object builders in Tellurium configuration


file so that they will be loaded automatically once the
framework starts.
 The framework currently wired in all pre-defined UI object


builders in the constructor. Since the registry is a hash map,
you can override a builder with a new one using the same UI
name.
Object Parser
 Thanks to Groovy’s builder pattern, we can define UI


object expressively and in a nested fashion. The DSL
object parser will parse the DSL object definition
recursively and use object builders to build the objects on
the fly.
 The parser is denoted as “ui” and that is why the UI


module definition always starts with “ui.”.
 An object registry is used to stored all objects. Each UI


module is an object tree. As a result, the object uid inside
a UI module must be unique and the top level object
UIDs must be different, but inner object UIDs on different
UI modules could be the same.
 The object registry is used by the framework to search


an object by its uid when walking through the full UID
such as “GoogleSearch.InputBox”.
DSL Context
 Domain Specific Language is a small language and can


only live inside its domain context. The DSL context is
the heart of the Tellurium and all UI modules must extend
the DslContext class
 Thanks to Groovy’s syntax, all the methods defined in


the DSL context can be written in an expressive way, i.e.,
DSL expression. For example, the following method
defines the DSL: “click id”
    •   def click(String id){}
 DSL context includes UI object definitions, event


actions, and data access.
  DslContext is extended to support Data Driving Testing,


which includes input file layout, test definition, and testing
flow.
UI Definition Sequence




• Sequence diagram for UI definition
Object-Locator Mapping
 Object-Locator Mapping is used to map UI uids


to their runtime locators
     – XPath Builder: generate runtime xpath based on
        given attributes
     – Group Locating: generate runtime xpath for the
        reference point if the “group” attribute is true
     – Locator Processing: call different locate stragies
        based on the locator type of the UI object to
        generate relative xpath (call XPath Builder and
        Group Locating if apply)
     – UI ID mapping: When reference a UI object by UID,
         for example, “issueSearch.searchBox”, walk
         through individual UI objects, i.e., “issueSearch”
         and “searchBox” in this case, and combine the
         generated relative xpaths to form the actual runtime
         xpath.
 Note: UI object can be found by its UID from the object


registry.
Event Handler
      Event Handler deals with all UI events such as “type”,
     

     “click”, “select”, ...
      By default, the event handler will add default events
     

     such as “mouseOver”, “mouseOut”, “focus”, and “blur” to
     event actions so that your test code can trigger
     Javascript events. You can turn this off in Tellurium
     configuration.
      Event Handler will look at the UI object’s respond
     

     attribute to include appropriate events for Javascript. For
     example,

id: quot;searchboxquot;, clocator: [title: quot;Google Searchquot;], respond: [quot;clickquot;, quot;focusquot;, quot;mouseOverquot;, quot;mouseOu
Data Accessor
  Data accessor is used to get data or attributes


from web, or check the status/availability of the UI
element. For example,
     –   getText()
     –   getValue()
     –   isElementPresent()
     –   isChecked()
     –   waitForElementPresent()
     –   getXpathCount()
Dispatcher
 The dispatcher will forward the events from the


event handler and method calls from the data
accessor to the selenium client.
The dispatcher is designed for future extension

so that we can switch to a different UI testing
engine similar to Selenium and keep the upper
layers intact.
Selenium Client
 Selenium Client sets up the connection, sends


commands to, and receive responses from
selenium server
Right now, we use Selenium RC Java client for

Selenium.
The Selenium Client supports custom methods

so that you can add new methods to selenium
core as user extensions.
Selenium Server
 Tellurium comes with an embedded Selenium Server and it


runs in a daemon thread
 If you need to run external selenium server, you should


specify the following in file TelluriumConfig.groovy
 runInternally = false



 If you need to run the external selenium server on a remote


machine, you should specify the following in file
TelluriumConfig.groovy
 serverHost = REMOTE_MACHINE_IP

How Tellurium works




• Sequence diagram for the “click” action
Tellurium JUnit Test Case
 TelluriumJavaTestCase is designed for JUnit 4.4 Test Case


and it supports the following annotations:
@BeforeClass




@AfterClass




@Before




@After




@Test




@Ignore





 It comes with predefined @BeforeClass and @AfterClass


methods to set up and tear down the connection to the
Selenium server before tests begin and after all tests are
done, respectively.
Tellurium TestNG Test Case
 TelluriumTestNGTestCase is similar to


TelluriumJavaTestCase and the difference is that it is for
TestNG
    For TestNG, you can use the following annotations:



@BeforeSuite, @AfterSuite




@BeforeTest, @AfterTest




@BeforeGroups, @AfterGroups




@BeforeClass, @AfterClass




@BeforeMethod, @AfterMethod




@DataProvider




@Parameters




@Test

Tellurium Groovy Test Case
 Tellurium is implemented in Groovy and Java.


You can use Groovy to write your test case as
well.
TelluriumGroovyTestCase is for a single test and

TelluriumSuiteGroovyTestCase is for a test suite.
DSL Script
 Tellurium supports Domain Specific Language


(DSL) for Web testing and you can even write all
your tests in pure DSL scripts.
Because of the Groovy Syntax, each method in

the DslContext can be written using DSL syntax.
Take the following mouseOver method as an
example,
mouseOver(String id)





    Its DSL format is:


      mouseOver id





    In your test script, you can write as follows,



     mouseOver quot;IdMenu.SortDownquot;
DSL Script (Cont’d)
 Tellurium also defined a set of DSLs to support


Tellurium tests:
     – openUrl url
     – connectUrl url

 you can also write assertions in JUnit in DSL


syntax, for example,
     – assertEquals rowNum, 8

 Tellurium supports pure dsl tests. The dsl script is


actually a Groovy class and it will be executed by
DslScriptExecutor.
DSL Script Executor
  The DSL script executor will read DSLs from a


.dsl file and run all the tests defined inside the .dsl
file.
The dsl script is actually a Groovy script file. You

can use Groovy syntax or Java syntax for the test
cases.
To make things easier for user, Tellurium comes

with a shell script rundsl.sh for Unix or Linux
systems and rundsl.bat for windows.
Tellurium Tools
  Tellurium sub-project TrUMP creates a Firefox plugin to


automatically generate UI modules for users.
The user just needs to click on the UI elements on the

web and UI modules will be automatically generated to
include all the selected UI elements.
The plugin only generates the UI modules, not the test

itself, which is the difference between TrUMP and
Selenium IDE. You need to define methods for the UI
modules and then write test cases based on the UI
modules.
For the time being, you need to use other tools to check

the runtime html and create UI module manually. The
useful tools include:
     – DOM Inspector
     – Xpather
     – Firebug
Tellurium Configuration
 Tellurium comes with a global configuration file,


TelluriumConfig.groovy, which sits in the project root
directory and you can change all the settings in this file. If
this file is missing, the framework will use the default settings
specified in Groovy classes.
 The configure file makes it very easy for users to customize


Tellurium.
 The configuration file includes the following sections:


          Embedded Server
      –
          Event Handler
      –
          Data Accessor
      –
          Connector
      –
          Data Driven
      –
          Test
      –
          UI Object
      –
          Widget
      –
tellurium{
    //embedded selenium server configuration
    embeddedserver {
        //port number
        port = quot;4444quot;
        //whether to use multiple windows
        useMultiWindows = false
        //whether to run the embedded selenium server. If false, you need to manually set up a selenium server
        runInternally = true
    }
    //event handler
    eventhandler{
        //whether we should check if the UI element is presented
        checkElement = true
        //wether we add additional events like quot;mouse overquot;
        extraEvent = true
    }
    //data accessor
    accessor{
        //whether we should check if the UI element is presented
        checkElement = true
    }
    //the configuration for the connector that connects the selenium client to the selenium server
    connector{
        //selenium server host
        //please change the host if you run the Selenium server remotely
        serverHost = quot;localhostquot;
        //server port number the client needs to connect
        port = quot;4444quot;
        //base URL
        baseUrl = quot;http://localhost:8080quot;
        //Browser setting, valid options are
        // *firefox [absolute path]
        // *iexplore [absolute path]
        // *chrome
        // *iehta
        browser = quot;*chromequot;
    }
    datadriven{
        dataprovider{
            //specify which data reader you like the data provider to use
            //the valid options include quot;PipeFileReaderquot;, quot;CVSFileReaderquot; at this point
            reader = quot;PipeFileReaderquot;
        }
    }
test{
         //at current stage, the result report is only for tellurium data driven testing
         //we may add the result report for regular tellurium test case
         result{
             //specify what result reporter used for the test result
             //valid options include quot;SimpleResultReporterquot;, quot;XMLResultReporterquot;, and quot;StreamXMLResultReporterquot;
             reporter = quot;XMLResultReporterquot;
             //the output of the result
             //valid options include quot;Consolequot;, quot;Filequot; at this point
             //if the option is quot;Filequot;, you need to specify the file name, other wise it will use the default
             //file name quot;TestResults.outputquot;
             output = quot;Consolequot;
             //test result output file name
             filename = quot;TestResult.outputquot;
         }
         exception{
             //whether Tellurium captures the screenshot when exception occurs.
             //Note that the exception is the one thrown by Selenium Server
             //we do not care the test logic errors here
             captureScreenshot = true
             //we may have a series of screenshots, specify the file name pattern here
             //Here the ? will be replaced by the timestamp and you might also want to put
             //file path in the file name pattern
             filenamePattern = quot;Screenshot?.pngquot;
         }
     }
     uiobject{
         builder{
             //user can specify custom UI objects here by define the builder for each UI object
             //the custom UI object builder must extend UiObjectBuilder class
             //and implement the following method:
             //
             // public build(Map map, Closure c)
             //
             //For container type UI object, the builder is a bit more complicated, please
             //take the TableBuilder or ListBuilder as an example

             //example:
//            Icon=quot;org.tellurium.builder.IconBuilderquot;

         }
     }
     widget{
         module{
             //define your widget modules here, for example Dojo or ExtJs
//             included=quot;dojo, extjsquot;
             included=quot;quot;
         }
     }
}
UI Objects: Basic UI Object
    Basic UI Object is the super class of all Tellurium UI objects



    It includes the following attributes:



uid: UI object's identifier




namespace: for future extension




locator: the locator of the UI object, could be a base locator or a composite locator




respond: the JavaScript events the UI object can respond to.





    It includes the following methods:



boolean isElementPresent()




boolean isVisible()




boolean isDisabled()




waitForElementPresent(int timeout), where the time unit is ms.




waitForElementPresent(int timeout, int step)




String getText()




mouseOver()




mouseOut()




getAttribute(String attribute)

UI Objects: Button
 Button represents various Buttons on the web


and its default tag is “input”.
The following additional methods can be applied

to Button:
click()




doubleClick()




clickAt(String coordination)





    Example:


Button(uid: quot;searchButtonquot;, clocator: [value: quot;Searchquot;, name: quot;btnquot;])

UI Objects: SubmitButton
 SubmitButton is a special Button with its type


being “submit”.
Example:


    •
SubmitButton(uid: quot;search_web_buttonquot;, clocator: [value: quot;Search the Webquot;])

UI Objects: CheckBox
 The CheckBox on the web is abstracted as the


“CheckBox” Ui object.
The default tag for CheckBox is “input” and its

type is “checkbox”.
CheckBox has the following additional methods:

check()




boolean isChecked()




uncheck()





    Example:


CheckBox(uid: quot;autoRenewalquot;, clocator: [dojoattachpoint: 'dap_auto_renew'])

UI Objects: Image
 Image is used to abstract the “img” tag and it


comes with the following additional methods:
getImageSource()




getImageAlt()




String getImageTitle()





    Example:


Image(uid: quot;dropDownArrowquot;, clocator: [src: 'drop_down_arrow.gif'])

UI Objects: Icon
 Icon is similar to the Image object, but user can


perform actions on it. As a result, it can have the
following additional methods:
click()




doubleClick()




clickAt(String coordination)





    Example:


Icon(uid: quot;taskIconquot;, clocator:[tag: quot;pquot;, dojoonclick: 'doClick', img: quot;Show_icon.gifquot;] )

UI Objects: RadioButton
  RadioButton is the abstract object for the Radio


Button UI. As a result, its default tag is “input” and
its type is “radio”.
RadioButton has the following additional

methods:
check()




boolean isChecked()




uncheck()




String getValue()





    Example:


RadioButton(uid: quot;autoRenewalquot;, clocator: [dojoattachpoint: 'dap_auto_renew'])

UI Objects: TextBox
 TextBox is the abstract UI object from which you


can get back text.
It comes with the following additional method:

String waitForText(int timeout)





 TextBox can have various types of tags.



Example:

TextBox(uid: quot;searchLabelquot;, clocator: [tag: quot;spanquot;])

UI Objects: InputBox
  InputBox is the UI where user types in input data.


As its name stands, InputBox's default tag is
“input”.
InputBox has the following additional methods:

type(String input)




keyType(String input), used to simulate keyboard typing




typeAndReturn(String input)




clearText()




boolean isEditable()




String getValue()





    Example:


InputBox(uid: quot;searchBoxquot;, clocator: [name: quot;qquot;])

UI Objects: UrlLink
 UrlLink stands for the web url link, i.e., its tag is


“a”.
UrlLink has the following additional methods:

String getLink()




click()




doubleClick()




clickAt(String coordination)





    Example:


UrlLink(uid: quot;Gridquot;, clocator: [text: quot;Gridquot;, direct: quot;truequot;])

UI Objects: Selector
 Selector represents the UI with tag “select” and


user can select from a set of options.
Selector has a lot of methods, such as:

selectByLabel(String target)




selectByValue(String value)




String[] getSelectOptions()




String getSelectedLabel()




String getSelectedValue()




String getSelectedIndex()




String getSelectedId()




boolean isSomethingSelected()





    Example:


Selector(uid: quot;issueTypequot;, clocator: [name: quot;canquot;, id: quot;canquot;])

UI Objects: Container
 Container is an abstract object that can hold a collection of


UI objects.
 Container has a special attribute quot;groupquot; and its default


value is false. If this attribute is true, the Group Locating is
enabled. In this case, make sure all the UI objects inside the
Container are children nodes of the Container in the DOM,
otherwise, you should not use the Group Locating capability.
    Example:



ui.Container(uid: quot;google_start_pagequot;, clocator: [tag: quot;tdquot;], group: quot;truequot;){




     InputBox(uid: quot;searchboxquot;, clocator: [title: quot;Google Searchquot;])




     SubmitButton(uid: quot;googlesearchquot;, clocator: [name: quot;btnGquot;, value: quot;Google Searchquot;])




     SubmitButton(uid: quot;Imfeelingluckyquot;, clocator: [value: quot;I'm Feeling Luckyquot;])




}

UI Objects: Form
  Form is a type of Container with its tag being “form” and


it represents web form.
 Like Container, it has the capability to use Group


Locating and it has a special method:
submit()





 This method is useful and can be used to submit input


data if the form does not have a submit button.
    Example:



ui.Form(uid: quot;downloadSearchquot;, clocator: [action: quot;listquot;, method: quot;getquot;], group: quot;truequot;) {




     Selector(uid: quot;downloadTypequot;, clocator: [name: quot;canquot;, id: quot;canquot;])




     TextBox(uid: quot;searchLabelquot;, clocator: [tag: quot;spanquot;])




     InputBox(uid: quot;searchBoxquot;, clocator: [name: quot;qquot;])




     SubmitButton(uid: quot;searchButtonquot;, clocator: [value: quot;Searchquot;])




}

UI Objects: List
 List is also a Container type abstract UI object and it can be


used to represent any list like UI objects.
 Users can define UI templates for List and following rule of


quot;the special case first and then the general casequot;.
    The index is used to specify an element



    It can use the Group Locating feature.



 List has one special attribute quot;separatorquot;, which is used to


indicate the tag used to separate different List UI elements.
    Example:



ui.List(uid: quot;subcategoryquot;, locator: quot;quot;, separator: quot;pquot;){




     InputBox(uid: quot;2quot;, clocator: [title: quot;Google Searchquot;])




     UrlLink(uid: quot;allquot;, clocator: [:])




}

UI Objects: Table
 Table is one of the most complicated UI Object and also


the most often used one.
 Its tag is “table” and a table could have headers besides


rows and columns. Table is a good choice for data grid.
 Table has different UID than other UI objects. For


example, if the id of the table is quot;table1quot;, then its i-th row
and j-th column is referenced as quot;table1[i][j]quot; and its m-th
header is quot;table1.header[m]quot;.
 Another distinguished feature of Table is that you can


define UI templates for its elements.
 Table can use the Group Locating feature.

UI Objects: Table (Cont’d)
 Templates inside the Table follow the following name


convention:
For the i-th row, j-th column, the uid should be “row: i, column: j”




The wild case for row or column is “*”




“all” stands for matching all rows and columns





    Table has the following special methods:



boolean hasHeader()




int getTableHeaderColumnNum()




int getTableMaxRowNum()




int getTableMaxColumnNum()

UI Objects: Table (Cont’d)
    Example (%% stands for partial matching):



ui.Table(uid: quot;downloadResultquot;, clocator: [id: quot;resultstablequot;, class: quot;resultsquot;], group: quot;truequot;)




{




     TextBox(uid: quot;header: 1quot;, clocator: [:])




     UrlLink(uid: quot;header: 2quot;, clocator: [text: quot;%%Filenamequot;])




     UrlLink(uid: quot;header: 3quot;, clocator: [text: quot;%%Summary + Labelsquot;])




     UrlLink(uid: quot;header: 4quot;, clocator: [text: quot;%%Uploadedquot;])




     UrlLink(uid: quot;header: 5quot;, clocator: [text: quot;%%Sizequot;])




     UrlLink(uid: quot;header: 6quot;, clocator: [text: quot;%%DownloadCountquot;])




     UrlLink(uid: quot;header: 7quot;, clocator: [text: quot;%%...quot;])




     InputBox(uid: quot;row: 2, colum: 2quot; clocator: [:])




     TextBox(uid: quot;row: *, column: 1quot;, clocator: [:])




     UrlLink(uid: quot;allquot;, clocator: [:])




}

UI Objects: Frame
 Frame is a type of Container and is used to represent


Frame or IFrame.
    It includes the following attributes:



id




name




title





    It has the following methods:



selectFrame(locator)




getWhetherThisFrameMatchFrameExpression(currentFrameString, target)




waitForFrameToLoad(frameAddress, timeout)





 When you test website with IFrames, you should use


multiple window mode., i.e., set the option useMultiWindows
to be true in file TelluriumConfig.groovy.
UI Objects: Frame (Cont’d)
    Example:


ui.Frame(uid: quot;SubscribeFramequot;, name: quot;subscrbequot;){




    Form(uid: quot;LoginFormquot;, clocator: [name: quot;loginFormquot;]){




        InputBox(uid: quot;UserNamequot;, clocator: [id: quot;usernamequot;, type: quot;textquot;])




        InputBox(uid: quot;Passwordquot;, clocator: [id: quot;passwordquot;, type: quot;passwordquot;])




        Button(uid: quot;Loginquot;, clocator: [type: quot;imagequot;, class: quot;loginquot;])




        CheckBox(uid: quot;RememberMequot;, clocator: [id: quot;remembermequot;])




    }




}

UI Objects: Window
 Window is a type of Container and is used to represent


a Popup Window.
    It includes the following attributes:



id




name




title





    It has the following methods


openWindow(String url, String windowID)




selectWindow(String windowID)




 boolean getWhetherThisWindowMatchWindowExpression(String currentWindowString,


String target)

waitForPopup(String windowID, int timeout)

UI Objects: Window (Cont’d)
     Example,


 ui.Window(uid: quot;HelpWindowquot;, name: quot;HelpWindowquot;){



–...
 }




     •
 openWindow helpUrl, quot;HelpWindowquot;




 waitForPopUp quot;HelpWindowquot;, 2000




 selectWindow quot;HelpWindowquot;




 ...




 selectMainWindow()

UI Objects: Option
 Option is designed to be adaptive the dynamic web. Option


is a pure abstract object and it holds multiple UI patterns
with each representing a possible UI at run time.
    Example,



ui.Option(uid: quot;layoutSelectorquot;){




     Container(uid: quot;layoutSelectorquot;, clocator: [tag: quot;divquot;], group: quot;truequot;) {




         TextBox(uid: quot;Listquot;, clocator: [tag: quot;bquot;, text: quot;Listquot;, direct: quot;truequot;])




         UrlLink(uid: quot;Gridquot;, clocator: [text: quot;Gridquot;, direct: quot;truequot;])




     }




     Container(uid: quot;layoutSelectorquot;, clocator: [tag: quot;divquot;], group: quot;truequot;) {




         UrlLink(uid: quot;Listquot;, clocator: [text: quot;Listquot;, direct: quot;truequot;])




         TextBox(uid: quot;Gridquot;, clocator: [tag: quot;bquot;, text: quot;Gridquot;, direct: quot;truequot;])




     }




}

UI Objects: Option (Cont’d)
 The option's UID must be the same as the next


UI objects it represents.
Then you can just use


 click “layoutSelector.List”



 to click on the UrlLink “List”.



The option object will automatically detect which

UI pattern you need to use at run time.
Widgets
 Tellurium provides you the capability to


composite UI objects into a widget object and then
you can use the widget directly just like using a
tellurium UI object.
The advantage is that you do not need to deal

with the UI at the link or button level for the
widget, you just work on the high level methods.
Another advantage is that this widget is reusable.


For widgets, it is important to include a name

space to avoid name collision between different
widget modules.
Widgets (Cont’d)
  Each widget module will be compiled as a separate jar


file and it should define a bootstrap class to register all
the widgets inside the module.
 Then in the tellurium configuration file


TelluriumConfig.groovy, you should include your module
name there, for example,
    widget{




        module{




            //define your widget modules here, for example Dojo or ExtJs




            included=quot;dojoquot;




        }




    }

Widgets (Cont’d)
 Widget is defined as a regular tellurium UI object.



For example, we use DOJO DatePicker Widget as

follows,
•
    ui.Form(uid: quot;dropdownquot;, clocator: [:], group: quot;truequot;){




            TextBox(uid: quot;labelquot;, clocator: [tag: quot;h4quot;, text: quot;Dropdown:quot;])




            InputBox(uid: quot;inputquot;, clocator: [dojoattachpoint: quot;valueInputNodequot;])




        Image(uid: quot;selectDatequot;, clocator: [title: quot;select a datequot;, dojoattachpoint:


quot;containerDropdownNodequot;, alt: quot;datequot;])
       DOJO_DatePicker(uid: quot;datePickerquot;, clocator: [tag: quot;divquot;, dojoattachpoint:


quot;subWidgetContainerNodequot;])
    }

Widgets (Cont’d)
 To make the testing more expressive, Tellurium


provides an onWidget method
onWidget(String uid, String method, Object[] args)





 In that way, we can call the widget methods as


follows:
onWidget quot;dropdown.datePickerquot;, selectPrevYear

DDT: Architecture
            Data Driven Testing is a
          

          different way to write
          tests, i.e., separate test
          data from the test scripts
          and the test flow is
          controlled by the input
          file.
           The system diagram is

          shown on the left.
DDT: Data Provider
 The data provider is the responsible for reading


data from input stream and converting data to
Java variables in data driven tests.
 It provides the following methods for users:

loadData file_name, load input data from a file.




useData String_name, load input data from a String in the test script




bind(quot;fieldSet field namequot;), bind a variable to a FieldSet field name




closeData, close the input data stream and report the test results




cacheVariable(name, variable), put variable into cache




getCachedVariable(name, variable), get variable from cache

DDT: TelluriumDataDrivenModule
 TelluriumDataDrivenModule is used to define modules,


where users can define UI Modules, FieldSets, and tests.
 FieldSet is used to define the format of one line of input


data and FieldSet consists of fields, i.e., columns, in the
input data. There is a special field “test”, which users can
specify what test this line of data apply to. For example,
fs.FieldSet(name: quot;GCHStatusquot;, description: quot;Google Code Hosting inputquot;) {




    Test(value: quot;getGCHStatusquot;)




    Field(name: quot;labelquot;)




    Field(name: quot;rowNumquot;, type: quot;intquot;)




    Field(name: quot;columNumquot;, type: quot;intquot;)




}

DDT: TelluriumDataDrivenModule
                   (Cont’d)
 The “defineTest” method is used to define a test in


the TelluriumDataDrivenModule, for example,
defineTest(quot;clickGCHLabelquot;){




    def row = bind(quot;GCHLabel.rowquot;)




    def column = bind(quot;GCHLabel.columnquot;)




    openUrl(quot;http://code.google.com/hosting/quot;)




    click quot;labels_table[2][1].[${row}][${column}]quot;




    waitForPageToLoad 30000




}





    Tellurium provides the methods for the results:


compareResult(expected, actual)




checkResult(result)




LogMessage (message)

DDT: TelluriumDataDrivenTest
 TelluriumDataDrivenTest is the class users should


extend to run the actual data driven testing.
Users need to do the following steps:


 use “includeModule” to load defined Modules



use “loadData” or “useData” to load input data stream


use “stepToEnd” to read the input data line by line and pick

up the specified test and run it, until reaches the end of the
data stream
use “closeData” to close the data stream and output the test

results
Tellurium Projects
    Tellurium includes the following sub-projects



 Tellurium Core: UI objects, locator mapping, and test
•

support.
•Tellurium DOJO widget: DOJO widget extension

•Tellurium Reference Projects: JUnit 4 and TestNG projects

to demonstrate how to create real world Tellurium test cases
using Tellurium project web site as a reference.
•TrUMP: Firefox Plugin to automatically generate UI modules

•Tellurium Engine: Similar to Selenium Core and will be

Tellurium test driving engine. More efficient and supports
nested UI object.
Tellurium Projects (Cont’d)
                                          Tellurium Core latest stable
                                         

                                         version is 0.5.0
      JUnit               TestNG
Reference Project    Reference Project
                                          Tellurium projects support ant
                                         

                                         and Maven build
               Tellurium Widget
                                          Tellurium supports Eclipse,
                                         

                                         Netbeans, and IntelliJ IDEs
                                          Tellurium currently supports
                Tellurium Core           
 TrUMP
                                         Groovy 1.6.0 and Selenium RC
                                         1.0
               Tellurium Engine
Tellurium UI Model Plugin (TrUMP)
                  • TrUMP IDE is a Firefox
                      plugin to automatically
                      create UI modules for
                      users
                  • Download TrUMP xpi file
                      from Tellurium project
                      site to install it
                  • Different xpi files for Firefox
                      3 and Firefox 2.
                  • They are the same except
                      the way to show the view
                      is different
                  • Logging and preference
                      support
TrUMP: How it works

                            Array
                                                    UI Module
Web page
              User Clicks


                  1                                                    Validate
                             Generate
                               2
                                                                Validator
                                    Customize
                                                            Validate
                                                3
           Internal Tree
TrUMP: Recording




• Click on any element you want to choose
• Click one more time to unselect
• Click on the selected element and TrUMP will show you where it is
     on the web
TrUMP: Generate




• The “Generate” button will generate an internal tree first
• Then TrUMP generates the default UI module
      – Selected attributes from a White list
      – Event handlers are converted to the respond attribute
      – Group option is off by default
TrUMP: Customize




• Group option is available to check
• Optional attributes are available to select
      – Position, header, and may others
TrUMP: How to Customize




  You can change UIDs and UI types
•
  Select or remove attributes
•
  Turn on group option
•
  TrUMP automatically validates the UI module, make sure you do
•
    not see any red “X” mark, or you do not care or act directly on
    the UI elements with red “X” mark
• Avoid attributes that may change such as position and header
TrUMP: Export UI Module
package tellurium.ui
import org.tellurium.dsl.DslContext
/**
 *  This UI module file is automatically generated by TrUMP 0.1.0.
 *
*/
class NewUiModule extends DslContext{
                public void defineUi() {
                        ui.Container(uid: quot;Telluriumquot;, clocator: [tag: quot;bodyquot;, class: quot;t2quot;]){
                                Form(uid: quot;Formquot;, clocator: [tag: quot;formquot;, method: quot;getquot;, action: quot;listquot;], group: quot;truequot;){
                                        Selector(uid: quot;DownloadTypequot;, clocator: [tag: quot;selectquot;, name: quot;canquot;, id: quot;canquot;])
                                        InputBox(uid: quot;SearchBoxquot;, clocator: [tag: quot;inputquot;, type: quot;textquot;, name: quot;qquot;, id: quot;qquot;])
                                        SubmitButton(uid: quot;Searchquot;, clocator: [tag: quot;inputquot;, type: quot;submitquot;, value: quot;Searchquot;])
                        }
                                Container(uid: quot;Titlequot;, clocator: [tag: quot;tablequot;, id: quot;mtquot;]){
                                        UrlLink(uid: quot;Issuesquot;, clocator: [tag: quot;aquot;, text: quot;Issuesquot;], respond: [quot;clickquot;])
                                        UrlLink(uid: quot;Wikiquot;, clocator: [tag: quot;aquot;, text: quot;Wikiquot;], respond: [quot;clickquot;])
                                        UrlLink(uid: quot;Downloadsquot;, clocator: [tag: quot;aquot;, text: quot;Downloadsquot;], respond: [quot;clickquot;])
                        }
                           }
                }
        //Add your methods here
}




• Export UI module to a groovy file with everything setting up for
    you
• You only need to fill up your methods to act on the UI based on
    your application
• Create JUnit or TestNG Java test cases based on the UI module
Outline

 Motivations



Overview


Introduction


Examples and Demo


Future Directions


Resources
How to use Tellurium?
                                   Use Tellurium jar and configuration file

Use Reference Project as               Manually create Project
        a base




                       Create UI modules

                                                 Groovy Class extends DslContext

                 Create methods for UI modules




                       Create Test Cases           In Java, Groovy, or DSL



                           Run Tests
Examples: Google Start Page
    Create UI Module



 Manual process now to look the runtime html
•


•HTML Tool: DOM Inspector, XPather, Firebug


•Automatically process in the future (TrUMP)



      class NewGoogleStartPage extends DslContext{
          public void defineUi() {
              ui.Container(uid: quot;google_start_pagequot;, clocator: [tag: quot;tdquot;], group: quot;truequot;){
                  InputBox(uid: quot;searchboxquot;, clocator: [title: quot;Google Searchquot;])
                  SubmitButton(uid: quot;googlesearchquot;, clocator: [name: quot;btnGquot;, value: quot;Google Searchquot;])
                  SubmitButton(uid: quot;Imfeelingluckyquot;, clocator: [value: quot;I'm Feeling Luckyquot;])
              }
          }

          def doGoogleSearch(String input){
              type quot;searchboxquot;, input
              pause 500
              click quot;googlesearchquot;
              waitForPageToLoad 30000
          }

          def doImFeelingLucky(String input){
              type quot;searchboxquot;, input
              pause 500
              click quot;Imfeelingluckyquot;
              waitForPageToLoad 30000
          }
      }
Examples: Google Start Page
             (Cont’d)
 Create JUnit test case




       public class GoogleStartPageJavaTestCase extends TelluriumJavaTestCase {

            protected static NewGoogleStartPage ngsp;

            @BeforeClass
            public static void initUi() {
                ngsp = new NewGoogleStartPage();
                ngsp.defineUi();
            }

            @Test
            public void testGoogleSearch(){
                connectUrl(quot;http://www.google.comquot;);
                ngsp.doGoogleSearch(quot;tellurium selenium Groovy Testquot;);
           }

           @Test
           public void testGoogleSearchFeelingLucky(){
                 connectUrl(quot;http://www.google.comquot;);
                 ngsp.doImFeelingLucky(quot;tellurium selenium DSL Testingquot;);
           }
       }
Example: DSL Script

//define google start page
ui.Container(uid: quot;google_start_pagequot;, clocator: [tag: quot;tdquot;], group: quot;truequot;){
    InputBox(uid: quot;searchboxquot;, clocator: [title: quot;Google Searchquot;])
    SubmitButton(uid: quot;googlesearchquot;, clocator: [name: quot;btnGquot;, value: quot;Google Searchquot;])
    SubmitButton(uid: quot;Imfeelingluckyquot;, clocator: [value: quot;I'm Feeling Luckyquot;])
}

//define Tellurium project menu
ui.Container(uid: quot;menuquot;, clocator: [tag: quot;tablequot;, id: quot;mtquot;, trailer: quot;/tbody/tr/thquot;], group: quot;truequot;){
    UrlLink(uid: quot;project_homequot;, clocator: [text: quot;%%Homequot;])
    UrlLink(uid: quot;downloadsquot;, clocator: [text: quot;Downloadsquot;])
    UrlLink(uid: quot;wikiquot;, clocator: [text: quot;Wikiquot;])
    UrlLink(uid: quot;issuesquot;, clocator: [text: quot;Issuesquot;])
    UrlLink(uid: quot;sourcequot;, clocator: [text: quot;Sourcequot;])
}

//define the Tellurium project search module, which includes an input box, two search buttons
ui.Form(uid: quot;searchquot;, clocator: [:], group: quot;truequot;){
    InputBox(uid: quot;searchboxquot;, clocator: [name: quot;qquot;])
    SubmitButton(uid: quot;search_project_buttonquot;, clocator: [value: quot;Search Projectsquot;])
    SubmitButton(uid: quot;search_web_buttonquot;, clocator: [value: quot;Search the Webquot;])
}
Example: DSL Script (Cont’d)

  openUrl quot;http://www.google.comquot;
  type quot;google_start_page.searchboxquot;, quot;Tellurium Seleniumquot;
  pause 500
  click quot;google_start_page.SubmitButtonquot;
  waitForPageToLoad 30000

  openUrl quot;http://code.google.com/p/aost/quot;
  click quot;menu.project_homequot;
  waitForPageToLoad 30000
  click quot;menu.downloadsquot;
  waitForPageToLoad 30000
  click quot;menu.wikiquot;
  waitForPageToLoad 30000
  click quot;menu.issuesquot;
  waitForPageToLoad 30000

  openUrl quot;http://code.google.com/p/aost/quot;
  type quot;search.searchboxquot;, quot;Tellurium Seleniumquot;
  click quot;search.search_project_buttonquot;
  waitForPageToLoad 30000

  type quot;search.searchboxquot;, quot;tellurium selenium dsl groovyquot;
  click quot;search.search_web_buttonquot;
  waitForPageToLoad 30000
Examples: DDT
 Create GoogleBookListModule



    class GoogleBookListModule extends TelluriumDataDrivenModule{

        public void defineModule() {
            //define UI module
            ui.Container(uid: quot;GoogleBooksListquot;, clocator: [tag: quot;tablequot;, id: quot;hp_tablequot;], group: quot;truequot;) {
                TextBox(uid: quot;categoryquot;, clocator: [tag: quot;divquot;, class: quot;sub_cat_titlequot;])
                List(uid: quot;subcategoryquot;, clocator: [tag: quot;divquot;, class: quot;sub_cat_sectionquot;], separator: quot;/pquot;) {
                    UrlLink(uid: quot;allquot;, locator: quot;/aquot;)
                }
            }

            //define file data format
            fs.FieldSet(name: quot;GoogleBookListquot;, description: quot;Google Book Listquot;) {
                Test(value: quot;checkBookListquot;)
                Field(name: quot;categoryquot;, description: quot;book categoryquot;)
                Field(name: quot;sizequot;, type: quot;intquot;, description: quot;google book list size quot;)
            }

            defineTest(quot;checkBookListquot;){
                def expectedCategory = bind(quot;GoogleBookList.categoryquot;)
                def expectedSize = bind(quot;GoogleBookList.sizequot;)
                openUrl(quot;http://books.google.com/quot;)
                String category = getText(quot;GoogleBooksList.categoryquot;)
                compareResult(expectedCategory, category)

                int size = getListSize(quot;GoogleBooksList.subcategoryquot;)
                //customize the compareResult and override its behaviour
                compareResult(expectedSize, size){
                    assertTrue(expectedSize == size)
                }
            }
        }
    }
Examples: DDT (Cont’d)
 Create GoogleCodeHostingModule




    class GoogleCodeHostingModule extends TelluriumDataDrivenModule{

       public void defineModule() {
          ui.Table(uid: quot;labels_tablequot;, clocator: [:], group: quot;truequot;){
            TextBox(uid: quot;row: 1, column: 1quot;, clocator: [tag: quot;divquot;, text: quot;Example project labels:quot;])
            Table(uid: quot;row: 2, column: 1quot;, clocator: [header: quot;/div[@id=quot;popularquot;]quot;]){
                UrlLink(uid: quot;allquot;, locator: quot;/aquot;)
              }
          }

           //define file data format
           fs.FieldSet(name: quot;GCHStatusquot;, description: quot;Google Code Hosting inputquot;) {
               Test(value: quot;getGCHStatusquot;)
               Field(name: quot;labelquot;)
               Field(name: quot;rowNumquot;, type: quot;intquot;)
               Field(name: quot;columNumquot;, type: quot;intquot;)
           }

           fs.FieldSet(name: quot;GCHLabelquot;, description: quot;Google Code Hosting inputquot;) {
               Test(value: quot;clickGCHLabelquot;)
               Field(name: quot;rowquot;, type: quot;intquot;)
               Field(name: quot;columnquot;, type: quot;intquot;)
           }
Examples: DDT (Cont’d)
         defineTest(quot;getGCHStatusquot;){
             def expectedLabel = bind(quot;GCHStatus.labelquot;)
             def expectedRowNum = bind(quot;GCHStatus.rowNumquot;)
             def expectedColumnNum = bind(quot;GCHStatus.columNumquot;)

             openUrl(quot;http://code.google.com/hosting/quot;)
             def label = getText(quot;labels_table[1][1]quot;)
             def rownum = getTableMaxRowNum(quot;labels_table[2][1]quot;)
             def columnum = getTableMaxColumnNum(quot;labels_table[2][1]quot;)

             compareResult(expectedLabel, label)
             compareResult(expectedRowNum, rownum)
             compareResult(expectedColumnNum, columnum)
             pause 1000
        }

        defineTest(quot;clickGCHLabelquot;){
            def row = bind(quot;GCHLabel.rowquot;)
            def column = bind(quot;GCHLabel.columnquot;)

            openUrl(quot;http://code.google.com/hosting/quot;)
            click quot;labels_table[2][1].[${row}][${column}]quot;

            waitForPageToLoad 30000
        }
    }
}
Examples: DDT (Cont’d)
 Create test class GoogleBookListCodeHostTest





       class GoogleBookListCodeHostTest extends TelluriumDataDrivenTest{

           public void testDataDriven() {

               includeModule   example.test.ddt.GoogleBookListModule.class
               includeModule   example.test.ddt.GoogleCodeHostingModule.class

               //load file
               loadData quot;src/test/example/test/ddt/GoogleBookListCodeHostInput.txtquot;

               //read each line and run the test script until the end of the file
               stepToEnd()

               //close file
               closeData()

           }
       }
Examples: DDT (Cont’d)
 The input file





              ##TEST should be always be the first column

              ##Data for test quot;checkBookListquot;
              ##TEST | CATEGORY | SIZE
              checkBookList|Fiction|8
              checkBookList|Fiction|3

              ##Data for test quot;getGCHStatusquot;
              ##TEST | LABEL | Row Number | Column Number
              getGCHStatus |Example project labels:| 3 | 6
              getGCHStatus |Example project| 3 | 6

              ##Data for test quot;clickGCHLabelquot;
              ##TEST | row | column
              clickGCHLabel | 1 | 1
              clickGCHLabel | 2 | 2
              clickGCHLabel | 3 | 3
Demo
Outline

 Motivations



Overview


Introduction


Examples and Demo


Future Directions


Resources
Future Directions
 Implement Locator Query Language (LQL) using


JQuery in Tellurium Core and Tellurium Engine.
Add UI template support for the TrUMP project.


Complete the DOJO widget project to add more

DOJO widgets.
Prototype Tellurium Engine project as Tellurium

test driving engine to support nested UI objects.
Outline

 Motivations



Overview


Introduction


Examples and Demo


Future Directions


Resources
Resources
    Tellurium Project website: http://code.google.com/p/aost/




    Tellurium User Group: http://groups.google.com/group/tellurium-users




    Groovy: http://groovy.codehaus.org/




    JQuery: http://jquery.com/




    JUnit: http://www.junit.org/




    TestNG: http://testng.org/doc/documentation-main.html




    HtmlUnit: http://htmlunit.sourceforge.net




    Canoo WebTest: http://webtest.canoo.com




    Selenium: http://seleniumhq.org/




    Twill: http://twill.idyll.org/


Contenu connexe

Tendances

준비하세요 Angular js 2.0
준비하세요 Angular js 2.0준비하세요 Angular js 2.0
준비하세요 Angular js 2.0Jeado Ko
 
Client-side JavaScript
Client-side JavaScriptClient-side JavaScript
Client-side JavaScriptLilia Sfaxi
 
Google Web Toolkits
Google Web ToolkitsGoogle Web Toolkits
Google Web ToolkitsYiguang Hu
 
TangoWithDjango - ch8
TangoWithDjango - ch8TangoWithDjango - ch8
TangoWithDjango - ch8Asika Kuo
 
Android programming -_pushing_the_limits
Android programming -_pushing_the_limitsAndroid programming -_pushing_the_limits
Android programming -_pushing_the_limitsDroidcon Berlin
 
JavaScript: DOM and jQuery
JavaScript: DOM and jQueryJavaScript: DOM and jQuery
JavaScript: DOM and jQuery維佋 唐
 
Visual Component Testing -- w/ Gil Tayar (Applitools) and Gleb Bahmutov (Cyp...
Visual Component Testing  -- w/ Gil Tayar (Applitools) and Gleb Bahmutov (Cyp...Visual Component Testing  -- w/ Gil Tayar (Applitools) and Gleb Bahmutov (Cyp...
Visual Component Testing -- w/ Gil Tayar (Applitools) and Gleb Bahmutov (Cyp...Applitools
 
Integration Testing With ScalaTest and MongoDB
Integration Testing With ScalaTest and MongoDBIntegration Testing With ScalaTest and MongoDB
Integration Testing With ScalaTest and MongoDBMichal Bigos
 
081107 Sammy Eclipse Summit2
081107   Sammy   Eclipse Summit2081107   Sammy   Eclipse Summit2
081107 Sammy Eclipse Summit2mkempka
 
More android code puzzles
More android code puzzlesMore android code puzzles
More android code puzzlesDanny Preussler
 
Using hilt in a modularized project
Using hilt in a modularized projectUsing hilt in a modularized project
Using hilt in a modularized projectFabio Collini
 
XCUITest for iOS App Testing and how to test with Xcode
XCUITest for iOS App Testing and how to test with XcodeXCUITest for iOS App Testing and how to test with Xcode
XCUITest for iOS App Testing and how to test with XcodepCloudy
 
Are app servers still fascinating
Are app servers still fascinatingAre app servers still fascinating
Are app servers still fascinatingAntonio Goncalves
 
Redux for ReactJS Programmers
Redux for ReactJS ProgrammersRedux for ReactJS Programmers
Redux for ReactJS ProgrammersDavid Rodenas
 
Performance, Games, and Distributed Testing in JavaScript
Performance, Games, and Distributed Testing in JavaScriptPerformance, Games, and Distributed Testing in JavaScript
Performance, Games, and Distributed Testing in JavaScriptjeresig
 

Tendances (20)

Rock GWT UI's with Polymer Elements
Rock GWT UI's with Polymer ElementsRock GWT UI's with Polymer Elements
Rock GWT UI's with Polymer Elements
 
UI testing in Xcode 7
UI testing in Xcode 7UI testing in Xcode 7
UI testing in Xcode 7
 
준비하세요 Angular js 2.0
준비하세요 Angular js 2.0준비하세요 Angular js 2.0
준비하세요 Angular js 2.0
 
Client-side JavaScript
Client-side JavaScriptClient-side JavaScript
Client-side JavaScript
 
Google Web Toolkits
Google Web ToolkitsGoogle Web Toolkits
Google Web Toolkits
 
TangoWithDjango - ch8
TangoWithDjango - ch8TangoWithDjango - ch8
TangoWithDjango - ch8
 
Android programming -_pushing_the_limits
Android programming -_pushing_the_limitsAndroid programming -_pushing_the_limits
Android programming -_pushing_the_limits
 
JavaScript: DOM and jQuery
JavaScript: DOM and jQueryJavaScript: DOM and jQuery
JavaScript: DOM and jQuery
 
Visual Component Testing -- w/ Gil Tayar (Applitools) and Gleb Bahmutov (Cyp...
Visual Component Testing  -- w/ Gil Tayar (Applitools) and Gleb Bahmutov (Cyp...Visual Component Testing  -- w/ Gil Tayar (Applitools) and Gleb Bahmutov (Cyp...
Visual Component Testing -- w/ Gil Tayar (Applitools) and Gleb Bahmutov (Cyp...
 
Integration Testing With ScalaTest and MongoDB
Integration Testing With ScalaTest and MongoDBIntegration Testing With ScalaTest and MongoDB
Integration Testing With ScalaTest and MongoDB
 
081107 Sammy Eclipse Summit2
081107   Sammy   Eclipse Summit2081107   Sammy   Eclipse Summit2
081107 Sammy Eclipse Summit2
 
More android code puzzles
More android code puzzlesMore android code puzzles
More android code puzzles
 
Using hilt in a modularized project
Using hilt in a modularized projectUsing hilt in a modularized project
Using hilt in a modularized project
 
droidparts
droidpartsdroidparts
droidparts
 
XCUITest for iOS App Testing and how to test with Xcode
XCUITest for iOS App Testing and how to test with XcodeXCUITest for iOS App Testing and how to test with Xcode
XCUITest for iOS App Testing and how to test with Xcode
 
Are app servers still fascinating
Are app servers still fascinatingAre app servers still fascinating
Are app servers still fascinating
 
Tuto jtatoo
Tuto jtatooTuto jtatoo
Tuto jtatoo
 
Redux for ReactJS Programmers
Redux for ReactJS ProgrammersRedux for ReactJS Programmers
Redux for ReactJS Programmers
 
Performance, Games, and Distributed Testing in JavaScript
Performance, Games, and Distributed Testing in JavaScriptPerformance, Games, and Distributed Testing in JavaScript
Performance, Games, and Distributed Testing in JavaScript
 
An introduction to Vue.js
An introduction to Vue.jsAn introduction to Vue.js
An introduction to Vue.js
 

Similaire à Tellurium.A.New.Approach.For.Web.Testing.V5

WebTest - Efficient Functional Web Testing with HtmlUnit and Beyond
WebTest - Efficient Functional Web Testing with HtmlUnit and BeyondWebTest - Efficient Functional Web Testing with HtmlUnit and Beyond
WebTest - Efficient Functional Web Testing with HtmlUnit and Beyondmguillem
 
Selenium RC: Automated Testing of Modern Web Applications
Selenium RC: Automated Testing of Modern Web ApplicationsSelenium RC: Automated Testing of Modern Web Applications
Selenium RC: Automated Testing of Modern Web Applicationsqooxdoo
 
Testing ASP.NET - Progressive.NET
Testing ASP.NET - Progressive.NETTesting ASP.NET - Progressive.NET
Testing ASP.NET - Progressive.NETBen Hall
 
Top100summit 谷歌-scott-improve your automated web application testing
Top100summit  谷歌-scott-improve your automated web application testingTop100summit  谷歌-scott-improve your automated web application testing
Top100summit 谷歌-scott-improve your automated web application testingdrewz lin
 
Automated Frontend Testing
Automated Frontend TestingAutomated Frontend Testing
Automated Frontend TestingNeil Crosby
 
jQuery 1.3 and jQuery UI
jQuery 1.3 and jQuery UIjQuery 1.3 and jQuery UI
jQuery 1.3 and jQuery UIjeresig
 
Three Simple Chords of Alternative PageObjects and Hardcore of LoadableCompon...
Three Simple Chords of Alternative PageObjects and Hardcore of LoadableCompon...Three Simple Chords of Alternative PageObjects and Hardcore of LoadableCompon...
Three Simple Chords of Alternative PageObjects and Hardcore of LoadableCompon...Iakiv Kramarenko
 
Progressive Enhancement with JavaScript and Ajax
Progressive Enhancement with JavaScript and AjaxProgressive Enhancement with JavaScript and Ajax
Progressive Enhancement with JavaScript and AjaxChristian Heilmann
 
Keep your Wicket application in production
Keep your Wicket application in productionKeep your Wicket application in production
Keep your Wicket application in productionMartijn Dashorst
 
George Thiruvathukal, User Experiences with Plone Content Management
George Thiruvathukal, User Experiences with Plone Content Management George Thiruvathukal, User Experiences with Plone Content Management
George Thiruvathukal, User Experiences with Plone Content Management webcontent2007
 
Browser-Based testing using Selenium
Browser-Based testing using SeleniumBrowser-Based testing using Selenium
Browser-Based testing using Seleniumret0
 
Selenium Testing Training in Bangalore
Selenium Testing Training in BangaloreSelenium Testing Training in Bangalore
Selenium Testing Training in Bangalorerajkamal560066
 
Building a JavaScript Library
Building a JavaScript LibraryBuilding a JavaScript Library
Building a JavaScript Libraryjeresig
 
Testing Ext JS and Sencha Touch
Testing Ext JS and Sencha TouchTesting Ext JS and Sencha Touch
Testing Ext JS and Sencha TouchMats Bryntse
 
UI Testing Automation
UI Testing AutomationUI Testing Automation
UI Testing AutomationAgileEngine
 
Browser Automated Testing Frameworks - Nightwatch.js
Browser Automated Testing Frameworks - Nightwatch.jsBrowser Automated Testing Frameworks - Nightwatch.js
Browser Automated Testing Frameworks - Nightwatch.jsLuís Bastião Silva
 
Selenium withnet
Selenium withnetSelenium withnet
Selenium withnetVlad Maniak
 
Integrating Selenium testing infrastructure into Scala Project
Integrating Selenium testing infrastructure into Scala ProjectIntegrating Selenium testing infrastructure into Scala Project
Integrating Selenium testing infrastructure into Scala ProjectKnoldus Inc.
 

Similaire à Tellurium.A.New.Approach.For.Web.Testing.V5 (20)

WebTest - Efficient Functional Web Testing with HtmlUnit and Beyond
WebTest - Efficient Functional Web Testing with HtmlUnit and BeyondWebTest - Efficient Functional Web Testing with HtmlUnit and Beyond
WebTest - Efficient Functional Web Testing with HtmlUnit and Beyond
 
Selenium RC: Automated Testing of Modern Web Applications
Selenium RC: Automated Testing of Modern Web ApplicationsSelenium RC: Automated Testing of Modern Web Applications
Selenium RC: Automated Testing of Modern Web Applications
 
Testing ASP.NET - Progressive.NET
Testing ASP.NET - Progressive.NETTesting ASP.NET - Progressive.NET
Testing ASP.NET - Progressive.NET
 
Top100summit 谷歌-scott-improve your automated web application testing
Top100summit  谷歌-scott-improve your automated web application testingTop100summit  谷歌-scott-improve your automated web application testing
Top100summit 谷歌-scott-improve your automated web application testing
 
Automated Frontend Testing
Automated Frontend TestingAutomated Frontend Testing
Automated Frontend Testing
 
jQuery 1.3 and jQuery UI
jQuery 1.3 and jQuery UIjQuery 1.3 and jQuery UI
jQuery 1.3 and jQuery UI
 
Three Simple Chords of Alternative PageObjects and Hardcore of LoadableCompon...
Three Simple Chords of Alternative PageObjects and Hardcore of LoadableCompon...Three Simple Chords of Alternative PageObjects and Hardcore of LoadableCompon...
Three Simple Chords of Alternative PageObjects and Hardcore of LoadableCompon...
 
Progressive Enhancement with JavaScript and Ajax
Progressive Enhancement with JavaScript and AjaxProgressive Enhancement with JavaScript and Ajax
Progressive Enhancement with JavaScript and Ajax
 
Keep your Wicket application in production
Keep your Wicket application in productionKeep your Wicket application in production
Keep your Wicket application in production
 
George Thiruvathukal, User Experiences with Plone Content Management
George Thiruvathukal, User Experiences with Plone Content Management George Thiruvathukal, User Experiences with Plone Content Management
George Thiruvathukal, User Experiences with Plone Content Management
 
Browser-Based testing using Selenium
Browser-Based testing using SeleniumBrowser-Based testing using Selenium
Browser-Based testing using Selenium
 
Selenium Testing Training in Bangalore
Selenium Testing Training in BangaloreSelenium Testing Training in Bangalore
Selenium Testing Training in Bangalore
 
Building a JavaScript Library
Building a JavaScript LibraryBuilding a JavaScript Library
Building a JavaScript Library
 
Testing Ext JS and Sencha Touch
Testing Ext JS and Sencha TouchTesting Ext JS and Sencha Touch
Testing Ext JS and Sencha Touch
 
Selenium
SeleniumSelenium
Selenium
 
Frontend training
Frontend trainingFrontend training
Frontend training
 
UI Testing Automation
UI Testing AutomationUI Testing Automation
UI Testing Automation
 
Browser Automated Testing Frameworks - Nightwatch.js
Browser Automated Testing Frameworks - Nightwatch.jsBrowser Automated Testing Frameworks - Nightwatch.js
Browser Automated Testing Frameworks - Nightwatch.js
 
Selenium withnet
Selenium withnetSelenium withnet
Selenium withnet
 
Integrating Selenium testing infrastructure into Scala Project
Integrating Selenium testing infrastructure into Scala ProjectIntegrating Selenium testing infrastructure into Scala Project
Integrating Selenium testing infrastructure into Scala Project
 

Dernier

办理学位证(TheAuckland证书)新西兰奥克兰大学毕业证成绩单原版一比一
办理学位证(TheAuckland证书)新西兰奥克兰大学毕业证成绩单原版一比一办理学位证(TheAuckland证书)新西兰奥克兰大学毕业证成绩单原版一比一
办理学位证(TheAuckland证书)新西兰奥克兰大学毕业证成绩单原版一比一Fi L
 
'CASE STUDY OF INDIRA PARYAVARAN BHAVAN DELHI ,
'CASE STUDY OF INDIRA PARYAVARAN BHAVAN DELHI ,'CASE STUDY OF INDIRA PARYAVARAN BHAVAN DELHI ,
'CASE STUDY OF INDIRA PARYAVARAN BHAVAN DELHI ,Aginakm1
 
西北大学毕业证学位证成绩单-怎么样办伪造
西北大学毕业证学位证成绩单-怎么样办伪造西北大学毕业证学位证成绩单-怎么样办伪造
西北大学毕业证学位证成绩单-怎么样办伪造kbdhl05e
 
Passbook project document_april_21__.pdf
Passbook project document_april_21__.pdfPassbook project document_april_21__.pdf
Passbook project document_april_21__.pdfvaibhavkanaujia
 
Call Girls Aslali 7397865700 Ridhima Hire Me Full Night
Call Girls Aslali 7397865700 Ridhima Hire Me Full NightCall Girls Aslali 7397865700 Ridhima Hire Me Full Night
Call Girls Aslali 7397865700 Ridhima Hire Me Full Nightssuser7cb4ff
 
原版美国亚利桑那州立大学毕业证成绩单pdf电子版制作修改#毕业文凭制作#回国入职#diploma#degree
原版美国亚利桑那州立大学毕业证成绩单pdf电子版制作修改#毕业文凭制作#回国入职#diploma#degree原版美国亚利桑那州立大学毕业证成绩单pdf电子版制作修改#毕业文凭制作#回国入职#diploma#degree
原版美国亚利桑那州立大学毕业证成绩单pdf电子版制作修改#毕业文凭制作#回国入职#diploma#degreeyuu sss
 
2024新版美国旧金山州立大学毕业证成绩单pdf电子版制作修改#毕业文凭制作#回国入职#diploma#degree
2024新版美国旧金山州立大学毕业证成绩单pdf电子版制作修改#毕业文凭制作#回国入职#diploma#degree2024新版美国旧金山州立大学毕业证成绩单pdf电子版制作修改#毕业文凭制作#回国入职#diploma#degree
2024新版美国旧金山州立大学毕业证成绩单pdf电子版制作修改#毕业文凭制作#回国入职#diploma#degreeyuu sss
 
Design and Managing Service in the field of tourism and hospitality industry
Design and Managing Service in the field of tourism and hospitality industryDesign and Managing Service in the field of tourism and hospitality industry
Design and Managing Service in the field of tourism and hospitality industryrioverosanniejoy
 
PORTFOLIO DE ARQUITECTURA CRISTOBAL HERAUD 2024
PORTFOLIO DE ARQUITECTURA CRISTOBAL HERAUD 2024PORTFOLIO DE ARQUITECTURA CRISTOBAL HERAUD 2024
PORTFOLIO DE ARQUITECTURA CRISTOBAL HERAUD 2024CristobalHeraud
 
8377877756 Full Enjoy @24/7 Call Girls in Nirman Vihar Delhi NCR
8377877756 Full Enjoy @24/7 Call Girls in Nirman Vihar Delhi NCR8377877756 Full Enjoy @24/7 Call Girls in Nirman Vihar Delhi NCR
8377877756 Full Enjoy @24/7 Call Girls in Nirman Vihar Delhi NCRdollysharma2066
 
Design principles on typography in design
Design principles on typography in designDesign principles on typography in design
Design principles on typography in designnooreen17
 
办理卡尔顿大学毕业证成绩单|购买加拿大文凭证书
办理卡尔顿大学毕业证成绩单|购买加拿大文凭证书办理卡尔顿大学毕业证成绩单|购买加拿大文凭证书
办理卡尔顿大学毕业证成绩单|购买加拿大文凭证书zdzoqco
 
在线办理ohio毕业证俄亥俄大学毕业证成绩单留信学历认证
在线办理ohio毕业证俄亥俄大学毕业证成绩单留信学历认证在线办理ohio毕业证俄亥俄大学毕业证成绩单留信学历认证
在线办理ohio毕业证俄亥俄大学毕业证成绩单留信学历认证nhjeo1gg
 
Untitled presedddddddddddddddddntation (1).pptx
Untitled presedddddddddddddddddntation (1).pptxUntitled presedddddddddddddddddntation (1).pptx
Untitled presedddddddddddddddddntation (1).pptxmapanig881
 
毕业文凭制作#回国入职#diploma#degree澳洲弗林德斯大学毕业证成绩单pdf电子版制作修改#毕业文凭制作#回国入职#diploma#degree
毕业文凭制作#回国入职#diploma#degree澳洲弗林德斯大学毕业证成绩单pdf电子版制作修改#毕业文凭制作#回国入职#diploma#degree 毕业文凭制作#回国入职#diploma#degree澳洲弗林德斯大学毕业证成绩单pdf电子版制作修改#毕业文凭制作#回国入职#diploma#degree
毕业文凭制作#回国入职#diploma#degree澳洲弗林德斯大学毕业证成绩单pdf电子版制作修改#毕业文凭制作#回国入职#diploma#degree ttt fff
 
FiveHypotheses_UIDMasterclass_18April2024.pdf
FiveHypotheses_UIDMasterclass_18April2024.pdfFiveHypotheses_UIDMasterclass_18April2024.pdf
FiveHypotheses_UIDMasterclass_18April2024.pdfShivakumar Viswanathan
 
Call Girls in Ashok Nagar Delhi ✡️9711147426✡️ Escorts Service
Call Girls in Ashok Nagar Delhi ✡️9711147426✡️ Escorts ServiceCall Girls in Ashok Nagar Delhi ✡️9711147426✡️ Escorts Service
Call Girls in Ashok Nagar Delhi ✡️9711147426✡️ Escorts Servicejennyeacort
 
办理(麻省罗威尔毕业证书)美国麻省大学罗威尔校区毕业证成绩单原版一比一
办理(麻省罗威尔毕业证书)美国麻省大学罗威尔校区毕业证成绩单原版一比一办理(麻省罗威尔毕业证书)美国麻省大学罗威尔校区毕业证成绩单原版一比一
办理(麻省罗威尔毕业证书)美国麻省大学罗威尔校区毕业证成绩单原版一比一diploma 1
 
CREATING A POSITIVE SCHOOL CULTURE CHAPTER 10
CREATING A POSITIVE SCHOOL CULTURE CHAPTER 10CREATING A POSITIVE SCHOOL CULTURE CHAPTER 10
CREATING A POSITIVE SCHOOL CULTURE CHAPTER 10uasjlagroup
 
ARt app | UX Case Study
ARt app | UX Case StudyARt app | UX Case Study
ARt app | UX Case StudySophia Viganò
 

Dernier (20)

办理学位证(TheAuckland证书)新西兰奥克兰大学毕业证成绩单原版一比一
办理学位证(TheAuckland证书)新西兰奥克兰大学毕业证成绩单原版一比一办理学位证(TheAuckland证书)新西兰奥克兰大学毕业证成绩单原版一比一
办理学位证(TheAuckland证书)新西兰奥克兰大学毕业证成绩单原版一比一
 
'CASE STUDY OF INDIRA PARYAVARAN BHAVAN DELHI ,
'CASE STUDY OF INDIRA PARYAVARAN BHAVAN DELHI ,'CASE STUDY OF INDIRA PARYAVARAN BHAVAN DELHI ,
'CASE STUDY OF INDIRA PARYAVARAN BHAVAN DELHI ,
 
西北大学毕业证学位证成绩单-怎么样办伪造
西北大学毕业证学位证成绩单-怎么样办伪造西北大学毕业证学位证成绩单-怎么样办伪造
西北大学毕业证学位证成绩单-怎么样办伪造
 
Passbook project document_april_21__.pdf
Passbook project document_april_21__.pdfPassbook project document_april_21__.pdf
Passbook project document_april_21__.pdf
 
Call Girls Aslali 7397865700 Ridhima Hire Me Full Night
Call Girls Aslali 7397865700 Ridhima Hire Me Full NightCall Girls Aslali 7397865700 Ridhima Hire Me Full Night
Call Girls Aslali 7397865700 Ridhima Hire Me Full Night
 
原版美国亚利桑那州立大学毕业证成绩单pdf电子版制作修改#毕业文凭制作#回国入职#diploma#degree
原版美国亚利桑那州立大学毕业证成绩单pdf电子版制作修改#毕业文凭制作#回国入职#diploma#degree原版美国亚利桑那州立大学毕业证成绩单pdf电子版制作修改#毕业文凭制作#回国入职#diploma#degree
原版美国亚利桑那州立大学毕业证成绩单pdf电子版制作修改#毕业文凭制作#回国入职#diploma#degree
 
2024新版美国旧金山州立大学毕业证成绩单pdf电子版制作修改#毕业文凭制作#回国入职#diploma#degree
2024新版美国旧金山州立大学毕业证成绩单pdf电子版制作修改#毕业文凭制作#回国入职#diploma#degree2024新版美国旧金山州立大学毕业证成绩单pdf电子版制作修改#毕业文凭制作#回国入职#diploma#degree
2024新版美国旧金山州立大学毕业证成绩单pdf电子版制作修改#毕业文凭制作#回国入职#diploma#degree
 
Design and Managing Service in the field of tourism and hospitality industry
Design and Managing Service in the field of tourism and hospitality industryDesign and Managing Service in the field of tourism and hospitality industry
Design and Managing Service in the field of tourism and hospitality industry
 
PORTFOLIO DE ARQUITECTURA CRISTOBAL HERAUD 2024
PORTFOLIO DE ARQUITECTURA CRISTOBAL HERAUD 2024PORTFOLIO DE ARQUITECTURA CRISTOBAL HERAUD 2024
PORTFOLIO DE ARQUITECTURA CRISTOBAL HERAUD 2024
 
8377877756 Full Enjoy @24/7 Call Girls in Nirman Vihar Delhi NCR
8377877756 Full Enjoy @24/7 Call Girls in Nirman Vihar Delhi NCR8377877756 Full Enjoy @24/7 Call Girls in Nirman Vihar Delhi NCR
8377877756 Full Enjoy @24/7 Call Girls in Nirman Vihar Delhi NCR
 
Design principles on typography in design
Design principles on typography in designDesign principles on typography in design
Design principles on typography in design
 
办理卡尔顿大学毕业证成绩单|购买加拿大文凭证书
办理卡尔顿大学毕业证成绩单|购买加拿大文凭证书办理卡尔顿大学毕业证成绩单|购买加拿大文凭证书
办理卡尔顿大学毕业证成绩单|购买加拿大文凭证书
 
在线办理ohio毕业证俄亥俄大学毕业证成绩单留信学历认证
在线办理ohio毕业证俄亥俄大学毕业证成绩单留信学历认证在线办理ohio毕业证俄亥俄大学毕业证成绩单留信学历认证
在线办理ohio毕业证俄亥俄大学毕业证成绩单留信学历认证
 
Untitled presedddddddddddddddddntation (1).pptx
Untitled presedddddddddddddddddntation (1).pptxUntitled presedddddddddddddddddntation (1).pptx
Untitled presedddddddddddddddddntation (1).pptx
 
毕业文凭制作#回国入职#diploma#degree澳洲弗林德斯大学毕业证成绩单pdf电子版制作修改#毕业文凭制作#回国入职#diploma#degree
毕业文凭制作#回国入职#diploma#degree澳洲弗林德斯大学毕业证成绩单pdf电子版制作修改#毕业文凭制作#回国入职#diploma#degree 毕业文凭制作#回国入职#diploma#degree澳洲弗林德斯大学毕业证成绩单pdf电子版制作修改#毕业文凭制作#回国入职#diploma#degree
毕业文凭制作#回国入职#diploma#degree澳洲弗林德斯大学毕业证成绩单pdf电子版制作修改#毕业文凭制作#回国入职#diploma#degree
 
FiveHypotheses_UIDMasterclass_18April2024.pdf
FiveHypotheses_UIDMasterclass_18April2024.pdfFiveHypotheses_UIDMasterclass_18April2024.pdf
FiveHypotheses_UIDMasterclass_18April2024.pdf
 
Call Girls in Ashok Nagar Delhi ✡️9711147426✡️ Escorts Service
Call Girls in Ashok Nagar Delhi ✡️9711147426✡️ Escorts ServiceCall Girls in Ashok Nagar Delhi ✡️9711147426✡️ Escorts Service
Call Girls in Ashok Nagar Delhi ✡️9711147426✡️ Escorts Service
 
办理(麻省罗威尔毕业证书)美国麻省大学罗威尔校区毕业证成绩单原版一比一
办理(麻省罗威尔毕业证书)美国麻省大学罗威尔校区毕业证成绩单原版一比一办理(麻省罗威尔毕业证书)美国麻省大学罗威尔校区毕业证成绩单原版一比一
办理(麻省罗威尔毕业证书)美国麻省大学罗威尔校区毕业证成绩单原版一比一
 
CREATING A POSITIVE SCHOOL CULTURE CHAPTER 10
CREATING A POSITIVE SCHOOL CULTURE CHAPTER 10CREATING A POSITIVE SCHOOL CULTURE CHAPTER 10
CREATING A POSITIVE SCHOOL CULTURE CHAPTER 10
 
ARt app | UX Case Study
ARt app | UX Case StudyARt app | UX Case Study
ARt app | UX Case Study
 

Tellurium.A.New.Approach.For.Web.Testing.V5

  • 1. Tellurium: A New Approach for Web Testing Jian Fang (John.Jian.Fang@gmail.com) Vivek Mongolu (vivekmongolu@gmail.com) Matt Senter (matt.senter@gmail.com) Haroon Rasheed (haroonzone@gmail.com) Quan Bui (Quan.Bui@gmail.com) Mikhail Koryak (koryak@gmail.com)
  • 3. What’s Wrong with Selenium • Take Tellurium project web site as an example. – The above UI includes one basic search module and one advanced search module – Use Selenium IDE and it generates the following Selenium test case
  • 4. Example Selenium Test case selenium.open(quot;/p/aost/issues/advsearchquot;); selenium.select(quot;//div[@id='maincol']/form/table/tbody/tr[1]/td[3]/selectquot;, quot;label=regexp:sAll Issuesquot;); selenium.type(quot;wordsquot;, quot;Telluriumquot;); selenium.type(quot;withoutquot;, quot;corequot;); selenium.click(quot;btnquot;); selenium.waitForPageToLoad(quot;30000quot;); ... Assertions ... selenium.open(quot;/p/aost/issues/advsearchquot;); selenium.select(quot;canquot;, quot;label=regexp:sAll Issuesquot;); selenium.type(quot;qquot;, quot;Telluriumquot;); selenium.click(quot;//input[@value='Search']quot;); selenium.waitForPageToLoad(quot;30000quot;); ... Assertions ...
  • 5. What do you observe? • Verbose – “Selenium.” everywhere – Locators everywhere • Not expressive – Can you see what the UI looks like? – Can you tell what the UI element that the locator is associated with? • Coupling – UI locators, actions, and assertions are coupled together • Fragile – Look at the xpath //div[@id='maincol']/form/table/tbody/tr[1]/td[3]/select • – What if the div or the table portions are changed? •
  • 6. What do you observe? (Cont’d) • Record and Play – Need to cover all testing scenarios – How about data dependency? – What if the UI is changed? • Refactor – Seems to be difficult, especially if you are not the person who wrote the tests. • Reusable – Less likely • Any way to handle dynamic factors on the web? – Dynamic data such as data grid and list of options – Javascript events
  • 7. How about Canoo WebTest • Canoo WebTest is an Open Source tool for automated testing of web import com.canoo.webtest.WebtestCase applications class SimpleTest extends WebtestCase { • Test cases in XML or void testWebtestOnGoogle() { Groovy webtest(quot;check that WebTest is Google's top 'WebTest' resultquot;) { • Use HtmlUnit as testing invoke quot;http://www.google.comquot;, description: quot;Go to Googlequot; driving engine verifyTitle quot;Googlequot; • Same problems as Selenium setInputField name: quot;qquot;, value: quot;WebTestquot; clickButton quot;I'm Feeling Luckyquot; Individual UI – verifyTitle quot;Canoo WebTestquot; Not robust – } Not reusable – } Test code couple with UI – } •
  • 8. What Else? • Twill is a simple language that allows users to browse the Web from a command-line interface – open source and written in Python – use link, forms, cookies, and most standard Web features – has a simple Python interface • Disadvantages Deal with individual UI – Need to parse html interactively, not convenient to use – Only support Python – Simple, not powerful – setlocal query quot;twill Pythonquot; go http://www.google.com/ fv 1 q $query submit btnI # use the quot;I'm feeling luckyquot; button show
  • 9. Motivations  Robust to changes  Easy to refactor Reusable Expressive Easy to use Address dynamic factors – Dynamic data – Dynamic web context – Javascript events – Propose: Tellurium Automated Testing Framework  (Tellurium)
  • 11. What is Tellurium? • Tellurium is a UI module based web testing framework • Tellurium is built on top of Selenium at the current stage – May have our own tellurium test driving engine in the future • Tellurium is implemented in Groovy and Java • Tellurium includes a set of Domain Specific Languages (DSLs) to define UI, actions, and tests • Tellurium handles the mapping from Java object to UI • Tellurium provides you the capability to write tests in – Java (JUnit 4 or TestNG) – Groovy – Pure DSL script • Tellurium supports Data Driven Testing
  • 12. What Tellurium looks like? • (I) Basic Search Module ui.Form(uid: quot;issueSearchquot;, clocator: [action: quot;listquot;, method: quot;getquot;], group: quot;truequot;) { TextBox(uid: quot;searchLabelquot;, clocator: [tag: quot;spanquot;]) Selector(uid: quot;issueTypequot;, clocator: [name: quot;canquot;, id: quot;canquot;]) InputBox(uid: quot;searchBoxquot;, clocator: [name: quot;qquot;]) SubmitButton(uid: quot;searchButtonquot;, clocator: [value: quot;Searchquot;]) }
  • 13. What Tellurium looks like? (Cont’d) • Advanced Search Module ui.Form(uid: quot;issueAdvancedSearchquot;, clocator: [action: quot;advsearch.doquot;, method: quot;postquot;], group: quot;truequot;) { Table(uid: quot;searchTablequot;, clocator: [class: quot;advqueryquot;]){ Selector(uid: quot;row:1, column: 3quot;, clocator: [name: quot;canquot;]) SubmitButton(uid: quot;row:1, column:4quot;, clocator: [value: quot;Searchquot;, name: quot;btnquot;]) InputBox(uid: quot;row:2, column:3quot;, clocator:[name: quot;wordsquot;]) InputBox(uid: quot;row:3, column:3quot;, clocator:[name: quot;withoutquot;]) } }
  • 14. What Tellurium looks like? (Cont’d) public void selectIssueType(String type){ selectByLabel quot;issueSearch.issueTypequot;, type } public void searchIssue(String issue){ keyType quot;issueSearch.searchBoxquot;, issue click quot;issueSearch.searchButtonquot; waitForPageToLoad 30000 } public void advancedSearchIssue(String issueType, String words, String without){ if(issueType != null){ selectByLabel quot;issueAdvancedSearch.searchTable[1][3]quot;, issueType } if(words != null){ keyType quot;issueAdvancedSearch.searchTable[2][3]quot;, words } if(without != null){ keyType quot;issueAdvancedSearch.searchTable[3][3]quot;, without } click quot;issueAdvancedSearch.searchTable[1][4]quot; waitForPageToLoad 30000 } Methods defined for UI modules
  • 15. How challenges are addressed in Tellurium • No longer “record and play” style, but UI module oriented – defining nested UI objects and methods as a UI module class, write your own test cases as many as you like based on the UI module class. • Decoupling – UI and tests are separated – UI is defined in a Groovy UI module class – Write your own test cases in Java, Groovy, or DSL scripts • Robust to changes – Composite locator (UI element attributes) is used to define UI and the actual xpath will be generated at runtime, i.e., different attributes -> different runtime xpath. UI module internal changes are addressed. – Group locating is used to remove the dependency of the UI objects from external UI elements, i.e., external UI changes will not affect the current UI module for most cases.
  • 16. How challenges are addressed in Tellurium • Easy to refactor – Refactor the individual UI module class • Reusable – UI module class could be re-used for the same application – Tellurium Widgets can be re-used for different applications • Expressive – UI module is straightforward – Groovy syntax – DSLs for actions and tests • Dynamic factors on web – UI templates for data grid or List of dynamic data – “respond” attribute in UI object for Javascript events – “Option” UI object for multiple possible UI patterns
  • 17. How challenges are addressed in Tellurium • Easy to use – Tellurium provides a configuration file for you to wire in your own new UI objects/widgets and customize the framework – Test can be written in • Java • Groovy • Pure DSL script – Support JUnit 4 and TestNG – Reference projects are provided to guide users on how to use Tellurium – Support ant and Maven build • Data Driven Testing
  • 19. Why Tellurium is A NEW Approach? • Tellurium comes with a set of new concepts that make Tellurium a different and new approach for Web Testing – UI Module – UID – Composite Locator – Group Locating – UI Template
  • 20. New Concepts: UI Module Tellurium Automated Testing Framework is UI  module based – UI module is a collection of UI elements you group them together – UI module represents a composite UI object in the format of nested basic UI elements – The UI elements inside the composite UI object have relationship to each other, i.e., logically or to be on the same subtree on the DOM – For each UI modules, you need to define a set of methods to act on the UI
  • 21. New Concepts: UID Form: “A” “A” Container: “C” “A.C” InputBox: “B” “A.B” Selector: “D” List: “E” “A.C.D” “A.C.E” UrlLink: “1” InputButton: “n” “A.C.E[1]” A.C.E[n] Each UI object has a UID and is referenced by cascading UIDs  Elements in List and Table are referenced by indexes  UID makes Tellurium less verbose and more expressive 
  • 22. New Concepts: Composite Locator Composite Locator (clocator): A set of attributes used to define  the object and the actual locator will be derived automatically at run time. For example, SubmitButton(uid: quot;googlesearchquot;, clocator: [name: quot;btnGquot;, value: quot;Google Searchquot;])  Which is equal to the following runtime xpath:  /input[@name=”btnG” and @value=”Google Search”]  The class definition is as follows,  class CompositeLocator {  –String header –String tag –String text –String trailer –def position –Map<String, String> attributes = [:] }  Each clocator will generate a run time relative xpath and it  makes Tellurium robust to changes inside UI module.
  • 23. New Concepts: Group Locating Usually XPath only includes one path to the target node,  for example, “/div/div/form/input”, that is to say, only information along this path is used. We can use information in the nested object such as the  whole form in Fig (B), i.e., “A Form whose children are input (attributes), selector (attributes), and input(attributes)”
  • 24. New Concepts: Group Locating (Cont’d) The composite object has a reference point and once the  reference point is determined, the other UI elements can be located by their relations to the reference point. Usually the top level element is the reference point. The quot;groupquot; attribute is used to turn on the group locating if  it is true. Please see the example of “downloadSearch” Form. By using group locating, the information defined in the UI  module itself is enough for you to locate all UI objects in that UI module and your UI module does not depend on the UI elements outside. For example, in the example, your Form object does not depend on the two outside divs, which makes Tellurium robust to outside changes.
  • 25. New Concepts: Group Locating (Cont’d) Scenarios  I.At least one of the UI element can be located by its own, for instance, the Selector node, then the Form node and other nodes can be located by their relative position to that UI element. II.One element itself cannot be located alone, but multiple element can be located jointly. For example, you cannot locate the inputs node alone, but you can locate the Form with children: two inputs, one selector. III.The information inside the UI module are not enough to locate them. You can either create another UI module to include more elements, or you have to use some information from outside. From our experience, most likely you will have scenario (I)  and (II). Right now, Tellurium exploits one level of information, i.e., the attributes of the direct children of the reference point. In the future, the Locator Query Language (LQL) will exploit more information.
  • 26. New Concepts: UI Template UI template can be used for  – Unknown number of UI elements, but the types are known – Many and similar UI elements Tellurium List and Table objects use UI templates to define the UI elements they include inside. List(uid: quot;subcategoryquot;, clocator: [tag: quot;divquot;, class:quot;sub_cat_sectionquot;]){ TextBox(uid: quot;2quot;, clocator: [tag: quot;divquot;, class: quot;sub_cat_titlequot;]) Container(uid: quot;allquot;, clocator: [tag: quot;pquot;]){ UrlLink(uid: quot;linkquot;, clocator: [:]) } } Table(uid: quot;searchTablequot;, clocator: [class: quot;advqueryquot;]){ Selector(uid: quot;row:1, column: 3quot;, clocator: [name: quot;canquot;]) SubmitButton(uid: quot;row:1, column:4quot;, clocator: [value: quot;Searchquot;, name: quot;btnquot;]) InputBox(uid: quot;row:2, column:3quot;, clocator:[name: quot;wordsquot;]) InputBox(uid: quot;row:3, column:3quot;, clocator:[name: quot;withoutquot;]) }
  • 27. Do you need to know Groovy ? Groovy is a dynamic language for Java  Compatible with Java syntax – Object oriented – More expressive – MetaClass for meta programming – Gstring: “label=${target}” – Closure – Optional type – Tellurium Core is implemented in Groovy and your UI  module class must be a Groovy class. But Test cases can be written in Java, Groovy, or pure DSL scripts. You do not really need to know Groovy when use Tellurium – UI definition is descriptive using DSL – Methods for UI module can be written in Java syntax – But using Groovy features will make your code more concise Groovy IDE support (Eclipse, Netbeans, IntelliJ) 
  • 29. UI Object UI Object includes  – uid: should be unique inside a UI module and the top level uids should be different for different UI modules. – namespace: for future extension – locator: the locator of the UI object, could be • A base locator (relative xpath) • A composite locator (object attributes) – group: this option only applies to a collection type of UI object such as Container, Table, List, and Form. If quot;groupquot; attribute to be true, group locating feature will turn on – respond: define what JavaScript events the UI object could respond to. •UI objects are held on an object registry, which consists of multiple object trees.
  • 30. Object Builder Object Builders are used to build the objects,  which are usually used by the framework itself. Users are unlikely to use them directly. The builders utilize the ability to instantiate a groovy object by passing object attributes in a map. They also use the groovy Closure so that the framework can customize the building procedure. The builders are heavily used by the DSL object parser to create UI objects from DSL on the fly.
  • 31. Object Builder Registry The object builder registry is designed so that the user can  add custom UI objects to the DSL context. Users can add new UI object builders to the object builder  registry by calling the following methods directly, • registerBuilder(new_name, new_builder) Or specify new UI object builders in Tellurium configuration  file so that they will be loaded automatically once the framework starts. The framework currently wired in all pre-defined UI object  builders in the constructor. Since the registry is a hash map, you can override a builder with a new one using the same UI name.
  • 32. Object Parser Thanks to Groovy’s builder pattern, we can define UI  object expressively and in a nested fashion. The DSL object parser will parse the DSL object definition recursively and use object builders to build the objects on the fly. The parser is denoted as “ui” and that is why the UI  module definition always starts with “ui.”. An object registry is used to stored all objects. Each UI  module is an object tree. As a result, the object uid inside a UI module must be unique and the top level object UIDs must be different, but inner object UIDs on different UI modules could be the same. The object registry is used by the framework to search  an object by its uid when walking through the full UID such as “GoogleSearch.InputBox”.
  • 33. DSL Context Domain Specific Language is a small language and can  only live inside its domain context. The DSL context is the heart of the Tellurium and all UI modules must extend the DslContext class Thanks to Groovy’s syntax, all the methods defined in  the DSL context can be written in an expressive way, i.e., DSL expression. For example, the following method defines the DSL: “click id” • def click(String id){} DSL context includes UI object definitions, event  actions, and data access. DslContext is extended to support Data Driving Testing,  which includes input file layout, test definition, and testing flow.
  • 34. UI Definition Sequence • Sequence diagram for UI definition
  • 35. Object-Locator Mapping Object-Locator Mapping is used to map UI uids  to their runtime locators – XPath Builder: generate runtime xpath based on given attributes – Group Locating: generate runtime xpath for the reference point if the “group” attribute is true – Locator Processing: call different locate stragies based on the locator type of the UI object to generate relative xpath (call XPath Builder and Group Locating if apply) – UI ID mapping: When reference a UI object by UID, for example, “issueSearch.searchBox”, walk through individual UI objects, i.e., “issueSearch” and “searchBox” in this case, and combine the generated relative xpaths to form the actual runtime xpath. Note: UI object can be found by its UID from the object  registry.
  • 36. Event Handler Event Handler deals with all UI events such as “type”,  “click”, “select”, ... By default, the event handler will add default events  such as “mouseOver”, “mouseOut”, “focus”, and “blur” to event actions so that your test code can trigger Javascript events. You can turn this off in Tellurium configuration. Event Handler will look at the UI object’s respond  attribute to include appropriate events for Javascript. For example, id: quot;searchboxquot;, clocator: [title: quot;Google Searchquot;], respond: [quot;clickquot;, quot;focusquot;, quot;mouseOverquot;, quot;mouseOu
  • 37. Data Accessor Data accessor is used to get data or attributes  from web, or check the status/availability of the UI element. For example, – getText() – getValue() – isElementPresent() – isChecked() – waitForElementPresent() – getXpathCount()
  • 38. Dispatcher The dispatcher will forward the events from the  event handler and method calls from the data accessor to the selenium client. The dispatcher is designed for future extension so that we can switch to a different UI testing engine similar to Selenium and keep the upper layers intact.
  • 39. Selenium Client Selenium Client sets up the connection, sends  commands to, and receive responses from selenium server Right now, we use Selenium RC Java client for Selenium. The Selenium Client supports custom methods so that you can add new methods to selenium core as user extensions.
  • 40. Selenium Server Tellurium comes with an embedded Selenium Server and it  runs in a daemon thread If you need to run external selenium server, you should  specify the following in file TelluriumConfig.groovy runInternally = false  If you need to run the external selenium server on a remote  machine, you should specify the following in file TelluriumConfig.groovy serverHost = REMOTE_MACHINE_IP 
  • 41. How Tellurium works • Sequence diagram for the “click” action
  • 42. Tellurium JUnit Test Case TelluriumJavaTestCase is designed for JUnit 4.4 Test Case  and it supports the following annotations: @BeforeClass  @AfterClass  @Before  @After  @Test  @Ignore  It comes with predefined @BeforeClass and @AfterClass  methods to set up and tear down the connection to the Selenium server before tests begin and after all tests are done, respectively.
  • 43. Tellurium TestNG Test Case TelluriumTestNGTestCase is similar to  TelluriumJavaTestCase and the difference is that it is for TestNG For TestNG, you can use the following annotations:  @BeforeSuite, @AfterSuite  @BeforeTest, @AfterTest  @BeforeGroups, @AfterGroups  @BeforeClass, @AfterClass  @BeforeMethod, @AfterMethod  @DataProvider  @Parameters  @Test 
  • 44. Tellurium Groovy Test Case Tellurium is implemented in Groovy and Java.  You can use Groovy to write your test case as well. TelluriumGroovyTestCase is for a single test and TelluriumSuiteGroovyTestCase is for a test suite.
  • 45. DSL Script Tellurium supports Domain Specific Language  (DSL) for Web testing and you can even write all your tests in pure DSL scripts. Because of the Groovy Syntax, each method in the DslContext can be written using DSL syntax. Take the following mouseOver method as an example, mouseOver(String id)  Its DSL format is:  mouseOver id  In your test script, you can write as follows,   mouseOver quot;IdMenu.SortDownquot;
  • 46. DSL Script (Cont’d) Tellurium also defined a set of DSLs to support  Tellurium tests: – openUrl url – connectUrl url you can also write assertions in JUnit in DSL  syntax, for example, – assertEquals rowNum, 8 Tellurium supports pure dsl tests. The dsl script is  actually a Groovy class and it will be executed by DslScriptExecutor.
  • 47. DSL Script Executor The DSL script executor will read DSLs from a  .dsl file and run all the tests defined inside the .dsl file. The dsl script is actually a Groovy script file. You can use Groovy syntax or Java syntax for the test cases. To make things easier for user, Tellurium comes with a shell script rundsl.sh for Unix or Linux systems and rundsl.bat for windows.
  • 48. Tellurium Tools Tellurium sub-project TrUMP creates a Firefox plugin to  automatically generate UI modules for users. The user just needs to click on the UI elements on the web and UI modules will be automatically generated to include all the selected UI elements. The plugin only generates the UI modules, not the test itself, which is the difference between TrUMP and Selenium IDE. You need to define methods for the UI modules and then write test cases based on the UI modules. For the time being, you need to use other tools to check the runtime html and create UI module manually. The useful tools include: – DOM Inspector – Xpather – Firebug
  • 49. Tellurium Configuration Tellurium comes with a global configuration file,  TelluriumConfig.groovy, which sits in the project root directory and you can change all the settings in this file. If this file is missing, the framework will use the default settings specified in Groovy classes. The configure file makes it very easy for users to customize  Tellurium. The configuration file includes the following sections:  Embedded Server – Event Handler – Data Accessor – Connector – Data Driven – Test – UI Object – Widget –
  • 50. tellurium{ //embedded selenium server configuration embeddedserver { //port number port = quot;4444quot; //whether to use multiple windows useMultiWindows = false //whether to run the embedded selenium server. If false, you need to manually set up a selenium server runInternally = true } //event handler eventhandler{ //whether we should check if the UI element is presented checkElement = true //wether we add additional events like quot;mouse overquot; extraEvent = true } //data accessor accessor{ //whether we should check if the UI element is presented checkElement = true } //the configuration for the connector that connects the selenium client to the selenium server connector{ //selenium server host //please change the host if you run the Selenium server remotely serverHost = quot;localhostquot; //server port number the client needs to connect port = quot;4444quot; //base URL baseUrl = quot;http://localhost:8080quot; //Browser setting, valid options are // *firefox [absolute path] // *iexplore [absolute path] // *chrome // *iehta browser = quot;*chromequot; } datadriven{ dataprovider{ //specify which data reader you like the data provider to use //the valid options include quot;PipeFileReaderquot;, quot;CVSFileReaderquot; at this point reader = quot;PipeFileReaderquot; } }
  • 51. test{ //at current stage, the result report is only for tellurium data driven testing //we may add the result report for regular tellurium test case result{ //specify what result reporter used for the test result //valid options include quot;SimpleResultReporterquot;, quot;XMLResultReporterquot;, and quot;StreamXMLResultReporterquot; reporter = quot;XMLResultReporterquot; //the output of the result //valid options include quot;Consolequot;, quot;Filequot; at this point //if the option is quot;Filequot;, you need to specify the file name, other wise it will use the default //file name quot;TestResults.outputquot; output = quot;Consolequot; //test result output file name filename = quot;TestResult.outputquot; } exception{ //whether Tellurium captures the screenshot when exception occurs. //Note that the exception is the one thrown by Selenium Server //we do not care the test logic errors here captureScreenshot = true //we may have a series of screenshots, specify the file name pattern here //Here the ? will be replaced by the timestamp and you might also want to put //file path in the file name pattern filenamePattern = quot;Screenshot?.pngquot; } } uiobject{ builder{ //user can specify custom UI objects here by define the builder for each UI object //the custom UI object builder must extend UiObjectBuilder class //and implement the following method: // // public build(Map map, Closure c) // //For container type UI object, the builder is a bit more complicated, please //take the TableBuilder or ListBuilder as an example //example: // Icon=quot;org.tellurium.builder.IconBuilderquot; } } widget{ module{ //define your widget modules here, for example Dojo or ExtJs // included=quot;dojo, extjsquot; included=quot;quot; } } }
  • 52. UI Objects: Basic UI Object Basic UI Object is the super class of all Tellurium UI objects  It includes the following attributes:  uid: UI object's identifier  namespace: for future extension  locator: the locator of the UI object, could be a base locator or a composite locator  respond: the JavaScript events the UI object can respond to.  It includes the following methods:  boolean isElementPresent()  boolean isVisible()  boolean isDisabled()  waitForElementPresent(int timeout), where the time unit is ms.  waitForElementPresent(int timeout, int step)  String getText()  mouseOver()  mouseOut()  getAttribute(String attribute) 
  • 53. UI Objects: Button Button represents various Buttons on the web  and its default tag is “input”. The following additional methods can be applied to Button: click()  doubleClick()  clickAt(String coordination)  Example:  Button(uid: quot;searchButtonquot;, clocator: [value: quot;Searchquot;, name: quot;btnquot;]) 
  • 54. UI Objects: SubmitButton SubmitButton is a special Button with its type  being “submit”. Example: • SubmitButton(uid: quot;search_web_buttonquot;, clocator: [value: quot;Search the Webquot;]) 
  • 55. UI Objects: CheckBox The CheckBox on the web is abstracted as the  “CheckBox” Ui object. The default tag for CheckBox is “input” and its type is “checkbox”. CheckBox has the following additional methods: check()  boolean isChecked()  uncheck()  Example:  CheckBox(uid: quot;autoRenewalquot;, clocator: [dojoattachpoint: 'dap_auto_renew']) 
  • 56. UI Objects: Image Image is used to abstract the “img” tag and it  comes with the following additional methods: getImageSource()  getImageAlt()  String getImageTitle()  Example:  Image(uid: quot;dropDownArrowquot;, clocator: [src: 'drop_down_arrow.gif']) 
  • 57. UI Objects: Icon Icon is similar to the Image object, but user can  perform actions on it. As a result, it can have the following additional methods: click()  doubleClick()  clickAt(String coordination)  Example:  Icon(uid: quot;taskIconquot;, clocator:[tag: quot;pquot;, dojoonclick: 'doClick', img: quot;Show_icon.gifquot;] ) 
  • 58. UI Objects: RadioButton RadioButton is the abstract object for the Radio  Button UI. As a result, its default tag is “input” and its type is “radio”. RadioButton has the following additional methods: check()  boolean isChecked()  uncheck()  String getValue()  Example:  RadioButton(uid: quot;autoRenewalquot;, clocator: [dojoattachpoint: 'dap_auto_renew']) 
  • 59. UI Objects: TextBox TextBox is the abstract UI object from which you  can get back text. It comes with the following additional method: String waitForText(int timeout)  TextBox can have various types of tags.  Example: TextBox(uid: quot;searchLabelquot;, clocator: [tag: quot;spanquot;]) 
  • 60. UI Objects: InputBox InputBox is the UI where user types in input data.  As its name stands, InputBox's default tag is “input”. InputBox has the following additional methods: type(String input)  keyType(String input), used to simulate keyboard typing  typeAndReturn(String input)  clearText()  boolean isEditable()  String getValue()  Example:  InputBox(uid: quot;searchBoxquot;, clocator: [name: quot;qquot;]) 
  • 61. UI Objects: UrlLink UrlLink stands for the web url link, i.e., its tag is  “a”. UrlLink has the following additional methods: String getLink()  click()  doubleClick()  clickAt(String coordination)  Example:  UrlLink(uid: quot;Gridquot;, clocator: [text: quot;Gridquot;, direct: quot;truequot;]) 
  • 62. UI Objects: Selector Selector represents the UI with tag “select” and  user can select from a set of options. Selector has a lot of methods, such as: selectByLabel(String target)  selectByValue(String value)  String[] getSelectOptions()  String getSelectedLabel()  String getSelectedValue()  String getSelectedIndex()  String getSelectedId()  boolean isSomethingSelected()  Example:  Selector(uid: quot;issueTypequot;, clocator: [name: quot;canquot;, id: quot;canquot;]) 
  • 63. UI Objects: Container Container is an abstract object that can hold a collection of  UI objects. Container has a special attribute quot;groupquot; and its default  value is false. If this attribute is true, the Group Locating is enabled. In this case, make sure all the UI objects inside the Container are children nodes of the Container in the DOM, otherwise, you should not use the Group Locating capability. Example:  ui.Container(uid: quot;google_start_pagequot;, clocator: [tag: quot;tdquot;], group: quot;truequot;){  InputBox(uid: quot;searchboxquot;, clocator: [title: quot;Google Searchquot;])  SubmitButton(uid: quot;googlesearchquot;, clocator: [name: quot;btnGquot;, value: quot;Google Searchquot;])  SubmitButton(uid: quot;Imfeelingluckyquot;, clocator: [value: quot;I'm Feeling Luckyquot;])  } 
  • 64. UI Objects: Form Form is a type of Container with its tag being “form” and  it represents web form. Like Container, it has the capability to use Group  Locating and it has a special method: submit()  This method is useful and can be used to submit input  data if the form does not have a submit button. Example:  ui.Form(uid: quot;downloadSearchquot;, clocator: [action: quot;listquot;, method: quot;getquot;], group: quot;truequot;) {  Selector(uid: quot;downloadTypequot;, clocator: [name: quot;canquot;, id: quot;canquot;])  TextBox(uid: quot;searchLabelquot;, clocator: [tag: quot;spanquot;])  InputBox(uid: quot;searchBoxquot;, clocator: [name: quot;qquot;])  SubmitButton(uid: quot;searchButtonquot;, clocator: [value: quot;Searchquot;])  } 
  • 65. UI Objects: List List is also a Container type abstract UI object and it can be  used to represent any list like UI objects. Users can define UI templates for List and following rule of  quot;the special case first and then the general casequot;. The index is used to specify an element  It can use the Group Locating feature.  List has one special attribute quot;separatorquot;, which is used to  indicate the tag used to separate different List UI elements. Example:  ui.List(uid: quot;subcategoryquot;, locator: quot;quot;, separator: quot;pquot;){  InputBox(uid: quot;2quot;, clocator: [title: quot;Google Searchquot;])  UrlLink(uid: quot;allquot;, clocator: [:])  } 
  • 66. UI Objects: Table Table is one of the most complicated UI Object and also  the most often used one. Its tag is “table” and a table could have headers besides  rows and columns. Table is a good choice for data grid. Table has different UID than other UI objects. For  example, if the id of the table is quot;table1quot;, then its i-th row and j-th column is referenced as quot;table1[i][j]quot; and its m-th header is quot;table1.header[m]quot;. Another distinguished feature of Table is that you can  define UI templates for its elements. Table can use the Group Locating feature. 
  • 67. UI Objects: Table (Cont’d) Templates inside the Table follow the following name  convention: For the i-th row, j-th column, the uid should be “row: i, column: j”  The wild case for row or column is “*”  “all” stands for matching all rows and columns  Table has the following special methods:  boolean hasHeader()  int getTableHeaderColumnNum()  int getTableMaxRowNum()  int getTableMaxColumnNum() 
  • 68. UI Objects: Table (Cont’d) Example (%% stands for partial matching):  ui.Table(uid: quot;downloadResultquot;, clocator: [id: quot;resultstablequot;, class: quot;resultsquot;], group: quot;truequot;)  {  TextBox(uid: quot;header: 1quot;, clocator: [:])  UrlLink(uid: quot;header: 2quot;, clocator: [text: quot;%%Filenamequot;])  UrlLink(uid: quot;header: 3quot;, clocator: [text: quot;%%Summary + Labelsquot;])  UrlLink(uid: quot;header: 4quot;, clocator: [text: quot;%%Uploadedquot;])  UrlLink(uid: quot;header: 5quot;, clocator: [text: quot;%%Sizequot;])  UrlLink(uid: quot;header: 6quot;, clocator: [text: quot;%%DownloadCountquot;])  UrlLink(uid: quot;header: 7quot;, clocator: [text: quot;%%...quot;])  InputBox(uid: quot;row: 2, colum: 2quot; clocator: [:])  TextBox(uid: quot;row: *, column: 1quot;, clocator: [:])  UrlLink(uid: quot;allquot;, clocator: [:])  } 
  • 69. UI Objects: Frame Frame is a type of Container and is used to represent  Frame or IFrame. It includes the following attributes:  id  name  title  It has the following methods:  selectFrame(locator)  getWhetherThisFrameMatchFrameExpression(currentFrameString, target)  waitForFrameToLoad(frameAddress, timeout)  When you test website with IFrames, you should use  multiple window mode., i.e., set the option useMultiWindows to be true in file TelluriumConfig.groovy.
  • 70. UI Objects: Frame (Cont’d) Example:  ui.Frame(uid: quot;SubscribeFramequot;, name: quot;subscrbequot;){  Form(uid: quot;LoginFormquot;, clocator: [name: quot;loginFormquot;]){  InputBox(uid: quot;UserNamequot;, clocator: [id: quot;usernamequot;, type: quot;textquot;])  InputBox(uid: quot;Passwordquot;, clocator: [id: quot;passwordquot;, type: quot;passwordquot;])  Button(uid: quot;Loginquot;, clocator: [type: quot;imagequot;, class: quot;loginquot;])  CheckBox(uid: quot;RememberMequot;, clocator: [id: quot;remembermequot;])  }  } 
  • 71. UI Objects: Window Window is a type of Container and is used to represent  a Popup Window. It includes the following attributes:  id  name  title  It has the following methods  openWindow(String url, String windowID)  selectWindow(String windowID)  boolean getWhetherThisWindowMatchWindowExpression(String currentWindowString,  String target) waitForPopup(String windowID, int timeout) 
  • 72. UI Objects: Window (Cont’d) Example,  ui.Window(uid: quot;HelpWindowquot;, name: quot;HelpWindowquot;){  –... }  • openWindow helpUrl, quot;HelpWindowquot;  waitForPopUp quot;HelpWindowquot;, 2000  selectWindow quot;HelpWindowquot;  ...  selectMainWindow() 
  • 73. UI Objects: Option Option is designed to be adaptive the dynamic web. Option  is a pure abstract object and it holds multiple UI patterns with each representing a possible UI at run time. Example,  ui.Option(uid: quot;layoutSelectorquot;){  Container(uid: quot;layoutSelectorquot;, clocator: [tag: quot;divquot;], group: quot;truequot;) {  TextBox(uid: quot;Listquot;, clocator: [tag: quot;bquot;, text: quot;Listquot;, direct: quot;truequot;])  UrlLink(uid: quot;Gridquot;, clocator: [text: quot;Gridquot;, direct: quot;truequot;])  }  Container(uid: quot;layoutSelectorquot;, clocator: [tag: quot;divquot;], group: quot;truequot;) {  UrlLink(uid: quot;Listquot;, clocator: [text: quot;Listquot;, direct: quot;truequot;])  TextBox(uid: quot;Gridquot;, clocator: [tag: quot;bquot;, text: quot;Gridquot;, direct: quot;truequot;])  }  } 
  • 74. UI Objects: Option (Cont’d) The option's UID must be the same as the next  UI objects it represents. Then you can just use click “layoutSelector.List”  to click on the UrlLink “List”.  The option object will automatically detect which UI pattern you need to use at run time.
  • 75. Widgets Tellurium provides you the capability to  composite UI objects into a widget object and then you can use the widget directly just like using a tellurium UI object. The advantage is that you do not need to deal with the UI at the link or button level for the widget, you just work on the high level methods. Another advantage is that this widget is reusable. For widgets, it is important to include a name space to avoid name collision between different widget modules.
  • 76. Widgets (Cont’d) Each widget module will be compiled as a separate jar  file and it should define a bootstrap class to register all the widgets inside the module. Then in the tellurium configuration file  TelluriumConfig.groovy, you should include your module name there, for example, widget{  module{  //define your widget modules here, for example Dojo or ExtJs  included=quot;dojoquot;  }  } 
  • 77. Widgets (Cont’d) Widget is defined as a regular tellurium UI object.  For example, we use DOJO DatePicker Widget as follows, • ui.Form(uid: quot;dropdownquot;, clocator: [:], group: quot;truequot;){  TextBox(uid: quot;labelquot;, clocator: [tag: quot;h4quot;, text: quot;Dropdown:quot;])  InputBox(uid: quot;inputquot;, clocator: [dojoattachpoint: quot;valueInputNodequot;])  Image(uid: quot;selectDatequot;, clocator: [title: quot;select a datequot;, dojoattachpoint:  quot;containerDropdownNodequot;, alt: quot;datequot;]) DOJO_DatePicker(uid: quot;datePickerquot;, clocator: [tag: quot;divquot;, dojoattachpoint:  quot;subWidgetContainerNodequot;]) } 
  • 78. Widgets (Cont’d) To make the testing more expressive, Tellurium  provides an onWidget method onWidget(String uid, String method, Object[] args)  In that way, we can call the widget methods as  follows: onWidget quot;dropdown.datePickerquot;, selectPrevYear 
  • 79. DDT: Architecture Data Driven Testing is a  different way to write tests, i.e., separate test data from the test scripts and the test flow is controlled by the input file.  The system diagram is shown on the left.
  • 80. DDT: Data Provider The data provider is the responsible for reading  data from input stream and converting data to Java variables in data driven tests.  It provides the following methods for users: loadData file_name, load input data from a file.  useData String_name, load input data from a String in the test script  bind(quot;fieldSet field namequot;), bind a variable to a FieldSet field name  closeData, close the input data stream and report the test results  cacheVariable(name, variable), put variable into cache  getCachedVariable(name, variable), get variable from cache 
  • 81. DDT: TelluriumDataDrivenModule TelluriumDataDrivenModule is used to define modules,  where users can define UI Modules, FieldSets, and tests. FieldSet is used to define the format of one line of input  data and FieldSet consists of fields, i.e., columns, in the input data. There is a special field “test”, which users can specify what test this line of data apply to. For example, fs.FieldSet(name: quot;GCHStatusquot;, description: quot;Google Code Hosting inputquot;) {  Test(value: quot;getGCHStatusquot;)  Field(name: quot;labelquot;)  Field(name: quot;rowNumquot;, type: quot;intquot;)  Field(name: quot;columNumquot;, type: quot;intquot;)  } 
  • 82. DDT: TelluriumDataDrivenModule (Cont’d) The “defineTest” method is used to define a test in  the TelluriumDataDrivenModule, for example, defineTest(quot;clickGCHLabelquot;){  def row = bind(quot;GCHLabel.rowquot;)  def column = bind(quot;GCHLabel.columnquot;)  openUrl(quot;http://code.google.com/hosting/quot;)  click quot;labels_table[2][1].[${row}][${column}]quot;  waitForPageToLoad 30000  }  Tellurium provides the methods for the results:  compareResult(expected, actual)  checkResult(result)  LogMessage (message) 
  • 83. DDT: TelluriumDataDrivenTest TelluriumDataDrivenTest is the class users should  extend to run the actual data driven testing. Users need to do the following steps: use “includeModule” to load defined Modules  use “loadData” or “useData” to load input data stream use “stepToEnd” to read the input data line by line and pick up the specified test and run it, until reaches the end of the data stream use “closeData” to close the data stream and output the test results
  • 84. Tellurium Projects Tellurium includes the following sub-projects  Tellurium Core: UI objects, locator mapping, and test • support. •Tellurium DOJO widget: DOJO widget extension •Tellurium Reference Projects: JUnit 4 and TestNG projects to demonstrate how to create real world Tellurium test cases using Tellurium project web site as a reference. •TrUMP: Firefox Plugin to automatically generate UI modules •Tellurium Engine: Similar to Selenium Core and will be Tellurium test driving engine. More efficient and supports nested UI object.
  • 85. Tellurium Projects (Cont’d) Tellurium Core latest stable  version is 0.5.0 JUnit TestNG Reference Project Reference Project Tellurium projects support ant  and Maven build Tellurium Widget Tellurium supports Eclipse,  Netbeans, and IntelliJ IDEs Tellurium currently supports Tellurium Core  TrUMP Groovy 1.6.0 and Selenium RC 1.0 Tellurium Engine
  • 86. Tellurium UI Model Plugin (TrUMP) • TrUMP IDE is a Firefox plugin to automatically create UI modules for users • Download TrUMP xpi file from Tellurium project site to install it • Different xpi files for Firefox 3 and Firefox 2. • They are the same except the way to show the view is different • Logging and preference support
  • 87. TrUMP: How it works Array UI Module Web page User Clicks 1 Validate Generate 2 Validator Customize Validate 3 Internal Tree
  • 88. TrUMP: Recording • Click on any element you want to choose • Click one more time to unselect • Click on the selected element and TrUMP will show you where it is on the web
  • 89. TrUMP: Generate • The “Generate” button will generate an internal tree first • Then TrUMP generates the default UI module – Selected attributes from a White list – Event handlers are converted to the respond attribute – Group option is off by default
  • 90. TrUMP: Customize • Group option is available to check • Optional attributes are available to select – Position, header, and may others
  • 91. TrUMP: How to Customize You can change UIDs and UI types • Select or remove attributes • Turn on group option • TrUMP automatically validates the UI module, make sure you do • not see any red “X” mark, or you do not care or act directly on the UI elements with red “X” mark • Avoid attributes that may change such as position and header
  • 92. TrUMP: Export UI Module package tellurium.ui import org.tellurium.dsl.DslContext /**  *  This UI module file is automatically generated by TrUMP 0.1.0.  * */ class NewUiModule extends DslContext{         public void defineUi() {                 ui.Container(uid: quot;Telluriumquot;, clocator: [tag: quot;bodyquot;, class: quot;t2quot;]){                         Form(uid: quot;Formquot;, clocator: [tag: quot;formquot;, method: quot;getquot;, action: quot;listquot;], group: quot;truequot;){                                 Selector(uid: quot;DownloadTypequot;, clocator: [tag: quot;selectquot;, name: quot;canquot;, id: quot;canquot;])                                 InputBox(uid: quot;SearchBoxquot;, clocator: [tag: quot;inputquot;, type: quot;textquot;, name: quot;qquot;, id: quot;qquot;])                                 SubmitButton(uid: quot;Searchquot;, clocator: [tag: quot;inputquot;, type: quot;submitquot;, value: quot;Searchquot;])                 }                         Container(uid: quot;Titlequot;, clocator: [tag: quot;tablequot;, id: quot;mtquot;]){                                 UrlLink(uid: quot;Issuesquot;, clocator: [tag: quot;aquot;, text: quot;Issuesquot;], respond: [quot;clickquot;])                                 UrlLink(uid: quot;Wikiquot;, clocator: [tag: quot;aquot;, text: quot;Wikiquot;], respond: [quot;clickquot;])                                 UrlLink(uid: quot;Downloadsquot;, clocator: [tag: quot;aquot;, text: quot;Downloadsquot;], respond: [quot;clickquot;])                 }                    }         }         //Add your methods here } • Export UI module to a groovy file with everything setting up for you • You only need to fill up your methods to act on the UI based on your application • Create JUnit or TestNG Java test cases based on the UI module
  • 94. How to use Tellurium? Use Tellurium jar and configuration file Use Reference Project as Manually create Project a base Create UI modules Groovy Class extends DslContext Create methods for UI modules Create Test Cases In Java, Groovy, or DSL Run Tests
  • 95. Examples: Google Start Page Create UI Module  Manual process now to look the runtime html • •HTML Tool: DOM Inspector, XPather, Firebug •Automatically process in the future (TrUMP) class NewGoogleStartPage extends DslContext{ public void defineUi() { ui.Container(uid: quot;google_start_pagequot;, clocator: [tag: quot;tdquot;], group: quot;truequot;){ InputBox(uid: quot;searchboxquot;, clocator: [title: quot;Google Searchquot;]) SubmitButton(uid: quot;googlesearchquot;, clocator: [name: quot;btnGquot;, value: quot;Google Searchquot;]) SubmitButton(uid: quot;Imfeelingluckyquot;, clocator: [value: quot;I'm Feeling Luckyquot;]) } } def doGoogleSearch(String input){ type quot;searchboxquot;, input pause 500 click quot;googlesearchquot; waitForPageToLoad 30000 } def doImFeelingLucky(String input){ type quot;searchboxquot;, input pause 500 click quot;Imfeelingluckyquot; waitForPageToLoad 30000 } }
  • 96. Examples: Google Start Page (Cont’d) Create JUnit test case  public class GoogleStartPageJavaTestCase extends TelluriumJavaTestCase { protected static NewGoogleStartPage ngsp; @BeforeClass public static void initUi() { ngsp = new NewGoogleStartPage(); ngsp.defineUi(); } @Test public void testGoogleSearch(){ connectUrl(quot;http://www.google.comquot;); ngsp.doGoogleSearch(quot;tellurium selenium Groovy Testquot;); } @Test public void testGoogleSearchFeelingLucky(){ connectUrl(quot;http://www.google.comquot;); ngsp.doImFeelingLucky(quot;tellurium selenium DSL Testingquot;); } }
  • 97. Example: DSL Script //define google start page ui.Container(uid: quot;google_start_pagequot;, clocator: [tag: quot;tdquot;], group: quot;truequot;){ InputBox(uid: quot;searchboxquot;, clocator: [title: quot;Google Searchquot;]) SubmitButton(uid: quot;googlesearchquot;, clocator: [name: quot;btnGquot;, value: quot;Google Searchquot;]) SubmitButton(uid: quot;Imfeelingluckyquot;, clocator: [value: quot;I'm Feeling Luckyquot;]) } //define Tellurium project menu ui.Container(uid: quot;menuquot;, clocator: [tag: quot;tablequot;, id: quot;mtquot;, trailer: quot;/tbody/tr/thquot;], group: quot;truequot;){ UrlLink(uid: quot;project_homequot;, clocator: [text: quot;%%Homequot;]) UrlLink(uid: quot;downloadsquot;, clocator: [text: quot;Downloadsquot;]) UrlLink(uid: quot;wikiquot;, clocator: [text: quot;Wikiquot;]) UrlLink(uid: quot;issuesquot;, clocator: [text: quot;Issuesquot;]) UrlLink(uid: quot;sourcequot;, clocator: [text: quot;Sourcequot;]) } //define the Tellurium project search module, which includes an input box, two search buttons ui.Form(uid: quot;searchquot;, clocator: [:], group: quot;truequot;){ InputBox(uid: quot;searchboxquot;, clocator: [name: quot;qquot;]) SubmitButton(uid: quot;search_project_buttonquot;, clocator: [value: quot;Search Projectsquot;]) SubmitButton(uid: quot;search_web_buttonquot;, clocator: [value: quot;Search the Webquot;]) }
  • 98. Example: DSL Script (Cont’d) openUrl quot;http://www.google.comquot; type quot;google_start_page.searchboxquot;, quot;Tellurium Seleniumquot; pause 500 click quot;google_start_page.SubmitButtonquot; waitForPageToLoad 30000 openUrl quot;http://code.google.com/p/aost/quot; click quot;menu.project_homequot; waitForPageToLoad 30000 click quot;menu.downloadsquot; waitForPageToLoad 30000 click quot;menu.wikiquot; waitForPageToLoad 30000 click quot;menu.issuesquot; waitForPageToLoad 30000 openUrl quot;http://code.google.com/p/aost/quot; type quot;search.searchboxquot;, quot;Tellurium Seleniumquot; click quot;search.search_project_buttonquot; waitForPageToLoad 30000 type quot;search.searchboxquot;, quot;tellurium selenium dsl groovyquot; click quot;search.search_web_buttonquot; waitForPageToLoad 30000
  • 99. Examples: DDT Create GoogleBookListModule  class GoogleBookListModule extends TelluriumDataDrivenModule{ public void defineModule() { //define UI module ui.Container(uid: quot;GoogleBooksListquot;, clocator: [tag: quot;tablequot;, id: quot;hp_tablequot;], group: quot;truequot;) { TextBox(uid: quot;categoryquot;, clocator: [tag: quot;divquot;, class: quot;sub_cat_titlequot;]) List(uid: quot;subcategoryquot;, clocator: [tag: quot;divquot;, class: quot;sub_cat_sectionquot;], separator: quot;/pquot;) { UrlLink(uid: quot;allquot;, locator: quot;/aquot;) } } //define file data format fs.FieldSet(name: quot;GoogleBookListquot;, description: quot;Google Book Listquot;) { Test(value: quot;checkBookListquot;) Field(name: quot;categoryquot;, description: quot;book categoryquot;) Field(name: quot;sizequot;, type: quot;intquot;, description: quot;google book list size quot;) } defineTest(quot;checkBookListquot;){ def expectedCategory = bind(quot;GoogleBookList.categoryquot;) def expectedSize = bind(quot;GoogleBookList.sizequot;) openUrl(quot;http://books.google.com/quot;) String category = getText(quot;GoogleBooksList.categoryquot;) compareResult(expectedCategory, category) int size = getListSize(quot;GoogleBooksList.subcategoryquot;) //customize the compareResult and override its behaviour compareResult(expectedSize, size){ assertTrue(expectedSize == size) } } } }
  • 100. Examples: DDT (Cont’d) Create GoogleCodeHostingModule  class GoogleCodeHostingModule extends TelluriumDataDrivenModule{ public void defineModule() { ui.Table(uid: quot;labels_tablequot;, clocator: [:], group: quot;truequot;){ TextBox(uid: quot;row: 1, column: 1quot;, clocator: [tag: quot;divquot;, text: quot;Example project labels:quot;]) Table(uid: quot;row: 2, column: 1quot;, clocator: [header: quot;/div[@id=quot;popularquot;]quot;]){ UrlLink(uid: quot;allquot;, locator: quot;/aquot;) } } //define file data format fs.FieldSet(name: quot;GCHStatusquot;, description: quot;Google Code Hosting inputquot;) { Test(value: quot;getGCHStatusquot;) Field(name: quot;labelquot;) Field(name: quot;rowNumquot;, type: quot;intquot;) Field(name: quot;columNumquot;, type: quot;intquot;) } fs.FieldSet(name: quot;GCHLabelquot;, description: quot;Google Code Hosting inputquot;) { Test(value: quot;clickGCHLabelquot;) Field(name: quot;rowquot;, type: quot;intquot;) Field(name: quot;columnquot;, type: quot;intquot;) }
  • 101. Examples: DDT (Cont’d) defineTest(quot;getGCHStatusquot;){ def expectedLabel = bind(quot;GCHStatus.labelquot;) def expectedRowNum = bind(quot;GCHStatus.rowNumquot;) def expectedColumnNum = bind(quot;GCHStatus.columNumquot;) openUrl(quot;http://code.google.com/hosting/quot;) def label = getText(quot;labels_table[1][1]quot;) def rownum = getTableMaxRowNum(quot;labels_table[2][1]quot;) def columnum = getTableMaxColumnNum(quot;labels_table[2][1]quot;) compareResult(expectedLabel, label) compareResult(expectedRowNum, rownum) compareResult(expectedColumnNum, columnum) pause 1000 } defineTest(quot;clickGCHLabelquot;){ def row = bind(quot;GCHLabel.rowquot;) def column = bind(quot;GCHLabel.columnquot;) openUrl(quot;http://code.google.com/hosting/quot;) click quot;labels_table[2][1].[${row}][${column}]quot; waitForPageToLoad 30000 } } }
  • 102. Examples: DDT (Cont’d) Create test class GoogleBookListCodeHostTest  class GoogleBookListCodeHostTest extends TelluriumDataDrivenTest{ public void testDataDriven() { includeModule example.test.ddt.GoogleBookListModule.class includeModule example.test.ddt.GoogleCodeHostingModule.class //load file loadData quot;src/test/example/test/ddt/GoogleBookListCodeHostInput.txtquot; //read each line and run the test script until the end of the file stepToEnd() //close file closeData() } }
  • 103. Examples: DDT (Cont’d) The input file  ##TEST should be always be the first column ##Data for test quot;checkBookListquot; ##TEST | CATEGORY | SIZE checkBookList|Fiction|8 checkBookList|Fiction|3 ##Data for test quot;getGCHStatusquot; ##TEST | LABEL | Row Number | Column Number getGCHStatus |Example project labels:| 3 | 6 getGCHStatus |Example project| 3 | 6 ##Data for test quot;clickGCHLabelquot; ##TEST | row | column clickGCHLabel | 1 | 1 clickGCHLabel | 2 | 2 clickGCHLabel | 3 | 3
  • 104. Demo
  • 106. Future Directions Implement Locator Query Language (LQL) using  JQuery in Tellurium Core and Tellurium Engine. Add UI template support for the TrUMP project. Complete the DOJO widget project to add more DOJO widgets. Prototype Tellurium Engine project as Tellurium test driving engine to support nested UI objects.
  • 108. Resources Tellurium Project website: http://code.google.com/p/aost/  Tellurium User Group: http://groups.google.com/group/tellurium-users  Groovy: http://groovy.codehaus.org/  JQuery: http://jquery.com/  JUnit: http://www.junit.org/  TestNG: http://testng.org/doc/documentation-main.html  HtmlUnit: http://htmlunit.sourceforge.net  Canoo WebTest: http://webtest.canoo.com  Selenium: http://seleniumhq.org/  Twill: http://twill.idyll.org/ 