My favorites | Sign in
Logo
                
Search
for
Updated Oct 28, 2009 by matt.senter
Labels: Phase-Implementation
UserGuide070GettingStarted  
Tellurium User Guide: Getting Started

(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:

Figure 2-1 Sample POM File

Tellurium Maven Archtypes

The easiest way to create a Tellurium project is to use Tellurium Maven archetypes. Tellurium provides two Maven archetypes:

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=tellurium \
   -DarchetypeVersion=0.7.0-SNAPSHOT \
   -DarchetypeRepository=http://maven.kungfuters.org/content/repositories/snapshots

For a Tellurium TestNG project, use:

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

Tellurium Ant Projects

For an Ant user:

  1. Download the following:
  2. Unpack the Tellurium dependency file to your project /lib directory together with the Tellurium core 0.6.0 jar file.
  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 is commercial and a free trial version for 30 days that can be downloaded from http://www.jetbrains.com/idea/download/index.html. A detailed guide is found on How to create your own Tellurium testing project with IntelliJ 7.0.

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.

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 the UI element 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: (See Figure 2-2.)

Figure 2-2 Search Module

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"])
    }
  }

  //Add your methods here
  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 TelluriumJavaTestCase class.

public class NewTestCase extends TelluriumJavaTestCase {
    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.


Sign in to add a comment
Hosted by Google Code