|
UserGuide070Introduction
Tellurium User Guide: Introduction
Featured (A PDF version of the user guide is available here)
What is TelluriumThe Tellurium Automated Testing Framework (Tellurium) is an automated testing framework for web applications. Tellurium grew up from the Selenium framework, but with a different testing concept. Starting from Tellurium 0.7.0, Tellurium added Tellurium Engine to replace the Selenium Core to better support Tellurium. Why Tellurium is NovelFor most existing web testing frameworks like Selenium, they mainly focus on individual UI elements as follows.
For example: selenium.click("//div[3]/input[@value='Create']");For Tellurium, we treated the whole UI elements as a widget and we call it a UI module.
We define the UI module as follows. ui.Form(uid: "Form", clocator: [tag: "form"]){
Div(uid: "User", clocator: [:]){
Selector(uid: "Sex", clocator: [:])
InputBox(uid: "Input", clocator: [tag: "input", type: "text", name: "j_username"])
}
Container(uid: "Finish", clocator: [tag: "tr"]){
SubmitButton(uid: "Submit", clocator: [tag: "input", type: "submit", value: "Login", name: "submit"])
}
}AdvantagesIf we think Selenium as the "C" language, Tellurium is like the "C++" language, which uses a different testing concept. There are couple advantages to describe the UI elements as a UI module. ExpressiveExpressive is obvious. For example, you can see clearly what the UI you are testing against. For the test code, you have DSL style test code such as: type "Form.User.Input", "John Fang" Robust to ChangesTest robust is always a big issue for Selenium. To solve this problem is one of the main motivations that Tellurium was created for. Tellurium uses UI attributes to describe UI instead of fixed locators. If we change the attributes, new runtime locators will be generated by the framework so that Tellurium can self-adapt to UI changes to some degree. The Santa algorithm in Tellurium new engine further improves the test robust by using UI partial matching. Represent Dynamic Web Content EasilyThe Tellurium UI templates are used to represent dynamic web content very easily. For example, Tellurium issue search result widget can be easily represented as follows. ui.Table(uid: "issueResult", clocator: [id: "resultstable", class: "results"], group: "true") {
//Define the header elements
UrlLink(uid: "{header: any} as ID", clocator: [text: "*ID"])
UrlLink(uid: "{header: any} as Type", clocator: [text: "*Type"])
UrlLink(uid: "{header: any} as Status", clocator: [text: "*Status"])
UrlLink(uid: "{header: any} as Priority", clocator: [text: "*Priority"])
UrlLink(uid: "{header: any} as Milestone", clocator: [text: "*Milestone"])
UrlLink(uid: "{header: any} as Owner", clocator: [text: "*Owner"])
UrlLink(uid: "{header: any} as Summary", clocator: [text: "*Summary + Labels"])
UrlLink(uid: "{header: any} as Extra", clocator: [text: "*..."])
//Define table body elements
//Column "Extra" are TextBoxs
TextBox(uid: "{row: all, column -> Extra}", clocator: [:])
//For the rest, they are UrlLinks
UrlLink(uid: "{row: all, column: all}", clocator: [:])
}Easy to MaintainTellurium emphasizes the decoupling of UI from test code. The structured test code makes Tellurium easier to maintain and refactor. MotivationAutomated web testing has always been one of the hottest and most important topics in the software testing arena when it comes to the rising popularity of Rich Internet applications (RIA) and Ajax-based web applications. With the advent of new web techniques such as RIA and Ajax, automated web testing tools must keep current with changes in technology and be able to address the following challenges:
The Tellurium Automated Testing Framework (Tellurium) is designed around these considerations and has defined as its focus the following goals:
Tellurium, the New Approach for Web TestingThe Tellurium Automated Testing Framework (Tellurium) is an open source automated testing framework for web applications that addresses the challenges and problems of today’s web testing. Most existing web testing tools/frameworks focus on individual UI elements such as links and buttons. Tellurium takes a new approach for automated web testing by using the concept of the UI module. The UI module is a collection of UI elements grouped together. Usually, the UI module represents a composite UI object in the format of nested basic UI elements. For example, the Google search UI module can be expressed as follows: ui.Container(uid: "GoogleSearchModule", clocator: [tag: "td"], group: "true"){
InputBox(uid: "Input", clocator: [title: "Google Search"])
SubmitButton(uid: "Search", clocator: [name: "btnG", value: "Google Search"])
SubmitButton(uid: "ImFeelingLucky", clocator: [value: "I'm Feeling Lucky"])
}Tellurium is built on the foundation of the UI module. The UI module makes it possible to build locators for UI elements at runtime. First, this makes Tellurium robust and responsive to changes from internal UI elements. Second, the UI module makes Tellurium expressive. UI elements can be referred to simply by appending the names (uid) along the path to the specific element. This also enables Tellurium's Group Locating feature, making composite objects reusable, and addressing dynamic web pages. Tellurium is implemented in Groovy and Java. The test cases can be written in Java, Groovy, or pure Domain Specific Language (DSL) scripts. Tellurium evolved out of Selenium. However, the UI testing approach is completely different. Tellurium is not a "record and replay" style framework, and it enforces the separation of UI modules from test code, making refactoring easy. For example, once the Google Search UI module is defined as previously shown, the test code is written as follows: type "GoogleSearchModule.Input", "Tellurium test" click "GoogleSearchModule.Search" Tellurium sets the Object to Locator Mapping (OLM) automatically at runtime so that UI objects can be defined simply by their attributes using Composite Locators. Tellurium uses the Group Locating Concept (GLC) to exploit information inside a collection of UI components so that locators can find their elements. Tellurium also defines a set of DSLs for web testing. Furthermore, Tellurium uses UI templates to define sets of dynamic UI elements at runtime. As a result, Tellurium is robust, expressive, flexible, reusable, and easy to maintain. The main features of Tellurium include:
How Challenges and Problems Are Addressed in TelluriumFirst, Tellurium does not use "record and replay". Instead, it uses the Tellurium Firefox plugin TrUMP to generate the UI module (not test code) for you. Then test code based on the UI module is created. In this way, the UI and the test code are decoupled. The structured test code in Tellurium makes it much easier to refactor and maintain the code. The composite locator uses UI element attributes to define the UI, and the actual locator (for example, XPath or jQuery selector), is generated at runtime. Any updates to the composite locator lead to different runtime locators, and the changes inside the UI module are localized. The Group locating is used to remove the dependency of the UI objects from external UI elements (for example, external UI changes do not affect the current UI module for most cases), so that test code is robust and responsive to changes up to a certain level. Tellurium uses the respond attribute in a UI object to specify JavaScript events, and the rest is handled automatically by the framework itself. UI templates are a powerful feature in Tellurium used to represent many identical UI elements or a dynamic size of different UI elements at runtime. This is extremely useful in testing dynamic web contexts such as a data grid. The Option UI object is designed to automatically address dynamic web contexts with multiple possible UI patterns. Re-usability is achieved by the UI module when working within one application and by Tellurium Widgets when working across different web applications. With the Domain Specific Language (DSL) in Tellurium, UI modules can be defined and test code written in a very expressive way. Tellurium also provides flexibility to write test code in Java, Groovy, or pure DSL scripts. HistoryTellurium was started in June 2007 as an internal project and became an open source project on Google Code in June 2008. We release on a regular basis and the latest release 0.7.0 will be out next month.
Team and CommunityTellurium Team consists of 4-5 active team members and couple more contributors. We have Tellurium user group and Tellurium developer group. Latest update information are available on http://twitter.com/TelluriumSource twitter. Tellurium also provides a community repository on GitHub so that anyone can fork Tellurium and contribute back to us. Tellurium wiki documents will be migrated to TelluriumSource.org, a domain owned by us. Tellurium Sub-projectsTellurium began as a small core project and quickly generated multiple sub-projects including: UDL, Core, Engine, Widget extensions, Maven Archetypes, and Trump sub-projects as shown in the following diagram.
| |