Get Even More Visitors To Your Blog, Upgrade To A Business Listing >>

Tellurium Selenium code example

Tellurium Selenium code example

Last week I introduced  tellurium selenium as an automation framework, part of the selenium integration. As I promised in previous article to come with some code example for the tellurium selenium tests and tellurium UI module.

As I’m a very practical guy I will try to explain why I like Tellurium, basically it simplifies the why you can write your tests and comes with an UI module that you don’t have to build from scratch.

Tellurium Selenium is a very good alternative for those of you who are used with frameworks in dynamic languages like ruby capybara. Tellurium is a very good option for those who doesn’t want to spend to much time in how to deal with browser session and how to share browser instance between step definitions.

Tellurium Selenium: Initial test example
package env;
import com.thoughworks.seleniu.*;

import net.sourceforge.htmlunit.corejs.javascript.ast.ThrowStatement;

import java.util.regex.Pattern;

public class NewTest extends SeleniumTestCase {

	public void setUp() throws Exception{
		setup("", "*chrome");
		public void testNew() throws Exception{"/");
			selenium.type("#name", "tellurium automatred test");"#button");
Tellurium Initial test
Tellurium Selenium: UI Module example
public class GoogleHomePage extends DSLContext {
	public void defineUI(){
		ui.Container(uid, "GooglePage"){
			InputBox(uid, "InputBox", locator: "#name")
			Button(uid, "Button", locator: "#button")
	public void doGoogleSearch(String input){
		type "GooglePage.InputBox", input
		click "GooglePage.Button"
Tewllurium selenium - ui module

The Tellurium UID description language (UDL) provides more flexibility to define dynamic web content.

Tellurium Selenium : Converted test
public class GoogleStartPageJavaTestCase extends TelluriumJavaTestCase {
	protected static GoogleHomePage ghp;
	public static void initUI(){
		ghp = new GoogleHomePage();
	public void testSearchGoogle(){
		ghp.doGoogleSearch("tellurium automated test");
Tellurium selenium Converted test
How does Tellurium works:
  1. First, the Tellurium Core converts the UI module into a JSON representation.
  2. The JSON representation is then passed to the Tellurium Engine for the first time when the UI module is used.
  3. The Tellurium Engine then uses the Santa algorithm to locate the whole UI module and put it into a cache.
  4. For the subsequent calls, the cached UI module is used instead of re-locating them again.
  5. In addition, the Tellurium core combines multiple commands into one batch called a macro command and then sends the batch to the Tellurium Engine in one call.  This reduces round trip latency.

There are advantages and disadvantages in using Tellurium selenium, Im not gonna enumerate here , I will let you find out whats best fro your project. It’s better to explore on your own corner cases about a framework and what defines you and your team better.

Happy Testing!

The post Tellurium Selenium code example appeared first on TestingRepository.

This post first appeared on Testing Repository - Creating Testing, please read the originial post: here

Share the post

Tellurium Selenium code example


Subscribe to Testing Repository - Creating Testing

Get updates delivered right to your inbox!

Thank you for your subscription