My favorites | Sign in
Project Home Downloads Wiki Issues Source
Search
for
UserGuide070GettingStarted  
Tellurium User Guide: Getting Started
Phase-Implementation, Phase-Support
Updated Jan 3, 2011 by John.Jian.Fang@gmail.com

(A PDF version of the user guide is available here)

Getting Started

This chapter discusses the Tellurium methods for creating a Tellurium project followed by descriptions of the primary components used for testing the newly created web framework including the UI Module, UI Object and attributes, Logical Container, jQuery Selector, UI Templates, and UI Testing Support.

Create a Tellurium Project

Create a Tellurium Project in one of the following methods:

Tellurium Maven Archetypes

The easiest way to create a Tellurium project is to use Tellurium Maven archetypes. Tellurium provides two Maven archetypes for Tellurium JUnit test projects and Tellurium TestNG test projects respectively.

  • tellurium-junit-archetype
  • tellurium-testng-archetype

As a result, a user can create a Tellurium project using one Maven command.

For a Tellurium JUnit project, use:

mvn archetype:create -DgroupId=your_group_id -DartifactId=your_artifact_id \
   -DarchetypeArtifactId=tellurium-junit-archetype \
   -DarchetypeGroupId=org.telluriumsource \
   -DarchetypeVersion=0.7.0 \
   -DarchetypeRepository=http://maven.kungfuters.org/content/repositories/releases

For a Tellurium TestNG project, use:

mvn archetype:create -DgroupId=your_group_id -DartifactId=your_artifact_id \
   -DarchetypeArtifactId=tellurium-testng-archetype \
   -DarchetypeGroupId=org.telluriumsource \
   -DarchetypeVersion=0.7.0 \
   -DarchetypeRepository=http://maven.kungfuters.org/content/repositories/releases

Note: for Maven 2.2.1, please use mvn archetype:generate instead.

Tellurium Ant Projects

For an Ant user:

  1. Download Tellurium 0.7.0 Release package from the Tellurium project download page
  2. Unpack the Tellurium 0.7.0 Release package and copy dependencies from the directory dependencies/lib to your project /lib directory together with the tellurium-core and tellurium-udl 0.7.0 jar files.
  3. Name the Tellurium configuration file as TelluriumConfig.groovy and place it in the project root directory.

For Ant build scripts, refer to the sample Tellurium Ant build scripts.

Setup Tellurium Project in IDEs

A Tellurium Project can be run in IntelliJ, NetBeans, Eclipse, or other IDEs that have Groovy support.

If using Maven, open the POM file to let the IDE automatically build the project files.

IntelliJ IDEA

IntelliJ IDEA Community edition is free and can be downloaded from http://www.jetbrains.com/idea/download/. A detailed guide is found on How to create your own Tellurium testing project with IntelliJ 9.0 Community Edition.

NetBeans IDE

For NetBeans users, detailed Guides can be found on the NetBeans Starters' guide page and How to create your own Tellurium testing project with NetBeans 6.5.

Eclipse

For Eclipse users, download the Eclipse Groovy Plugin from http://dist.codehaus.org/groovy/distributions/update/ to run the Tellurium project.

For detailed instructions, read How to create your own Tellurium testing project with Eclipse.

Create a UI Module

Tellurium provides TrUMP to automatically create UI modules. TrUMP can be downloaded from the Tellurium project site:

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

Choose the Firefox 2 or Firefox 3 version depending upon the user’s Firefox version, or download the Firefox 3 version directly from the Firefox addons site at:

https://addons.mozilla.org/en-US/firefox/addon/11035

Once installed, restart Firefox. Record UI modules by simply clicking UI elements on the web and then click the "Generate" button.

To customize the UI, click the "Customize" button.

In the example, open the Tellurium download page found on:

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

Record the download search module as follows:

After the UI module is customized, export it as the module file NewUiModule.groovy to the demo project and add a couple of methods to the class:

class NewUiModule extends DslContext {

  public void defineUi() {
    ui.Form(uid: "TelluriumDownload", clocator: [tag: "form", method: "get", 
       action: "list"], group: "true") 
    {
      Selector(uid: "DownloadType", clocator: [tag: "select", name: "can", id: "can"])
      InputBox(uid: "Input", clocator: [tag: "input", type: "text", name: "q", id: "q"])
      SubmitButton(uid: "Search", clocator: [tag: "input", type: "submit", 
               value: "Search"])
    }
  }

  public void searchDownload(String keyword) {
    keyType "TelluriumDownload.Input", keyword
    click "TelluriumDownload.Search"
    waitForPageToLoad 30000
  }

  public String[] getAllDownloadTypes() {
    return getSelectOptions("TelluriumDownload.DownloadType")
  }

  public void selectDownloadType(String type) {
    selectByLabel "TelluriumDownload.DownloadType", type
  }
}

Create Tellurium Test Cases

Once the UI module is created, create a new Tellurium test case NewTestCase by extending TelluriumJUnitTestCase class.

public class NewTestCase extends TelluriumJUnitTestCase {
    private static NewUiModule app;

    @BeforeClass
    public static void initUi() {
        app = new NewUiModule();
        app.defineUi();
    }

    @Before
    public void setUpForTest() {
        connectUrl("http://code.google.com/p/aost/downloads/list");
    }

    @Test
    public void testTelluriumProjectPage() {
        String[] allTypes = app.getAllDownloadTypes();
        assertNotNull(allTypes);
        assertTrue(allTypes[1].contains("All Downloads"));
        app.selectDownloadType(allTypes[1]);
        app.searchDownload("TrUMP");
    }
}

Compile the project and run the new test case.

Comment by asga...@gmail.com, Jan 3, 2011

The example with creating a test project with maven specified above does not work in maven 2.2.1

mvn archetype:create is deprecated. You have to use mvn archetype:generate instead.


Sign in to add a comment
Powered by Google Project Hosting