Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Building a test in Selenium IDE is easy. Open the IDE (in Firefox, Tools > Selenium IDE) and navigate to your DSpace instance in a tab of Firefox (i.e.: http://localhost:8080/jspui/Image Removed). Press the record button (red circle at top-right corner) in the Selenium IDE and navigate through your application. Selenium will record every click you do and text you write in the screen. If you do a mistake, you can right-click over an entry in the list and remove it.

...

To run the tests simply open the Selenium IDE (in Firefox, Tools > Selenium IDE) and navigate to your DSpace instance in a tab of Firefox (i.e.: http://localhost:8080/jspui/Image Removed). Then, in the Selenium IDE, click on File > Open and select a test case. You can open as many files as you want, they will be run in the order you opened them.

...

You can edit the tests (see the format above) and change the required values (like user and path to a file) to values which are valid in your system.

Advanced

...

Usage

If you set up Selenium RC, you can reuse the test scripts to be run as JUnit tests. Selenium can export them automatically to Java classes using JUnit. For this open the Selenium IDE (in Firefox, Tools > Selenium IDE), click on File > Open and select a test case. Once the test case is loaded, click on File > Export Test Case As > Java (JUnit) - Selenium RC. This will create a Java class that reproduces the test case, as the following:

Code Block

package com.example.tests;

import com.thoughtworks.selenium.*;
import java.util.regex.Pattern;

public class CreateCommunity extends SeleneseTestCase {
    public void setUp() throws Exception {
        setUp("http://localhost:8080/", "*chrome");
    }
    public void testJunit() throws Exception {
        selenium.open("/jspui/");
        selenium.click("xpath=//a[contains(@href, '/jspui/community-list')]");
        selenium.waitForPageToLoad("30000");
        selenium.click("link=Issue Date");
        selenium.waitForPageToLoad("30000");
        selenium.click("link=Author");
        selenium.waitForPageToLoad("30000");
        
        [... ]
    }
}

As you can see in the code, this class suffers from the same problems as the Selenium IDE scripts (hardcoded values, etc) but can be run using Selenium RC in a distributed environment, alongside your JUnit tests.

Future Work

This project creates a structure for testing that can expanded. Future tasks would include:

...