This Confluence has been LDAP enabled, if you are an ASF Committer, please use your LDAP Credentials to login. Any problems file an INFRA jira ticket please.

Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Update Jiral inks

One of the GSoc 2011 task : https://issues.apache.org/jira/browse/

Jira
serverASF JIRA
serverId5aa69414-a9e9-3523-82ec-879b028fb15b
keyOFBIZ-4211

Related Issue: https://issues.apache.org/jira/browse/

Jira
serverASF JIRA
serverId5aa69414-a9e9-3523-82ec-879b028fb15b
keyOFBIZ-4189

Why selenium 2 ?

Selenium 2.0 is including htmlUnit, which makes it easy to run on an headless server. The driver used (htmlUnit, firefox, …) can be changed, and then drive a real browser.

...

The architecture will be copied on the existing run-tests task.
Tests will be listed in each component in the ofbiz-component.xml file. A new type will be created for those : func-test-suite

Code Block
xml
xml
    <func-test-suite loader="main" location="testdef/NameOfTestSuite.xml"/>

...

A simple example: login to party application

Code Block
java
java

import org.openqa.selenium.By;
import org.openqa.selenium.htmlunit.HtmlUnitDriver;

import junit.framework.TestCase;


public class OfbizConnection extends TestCase{
    HtmlUnitDriver driver;

    public void setUp() throws Exception {
        driver = new HtmlUnitDriver();
    }

    public void tearDown() throws Exception {
        driver.quit();
    }

    public void testConnection() throws Exception {
        driver.get("https://localhost:8443/partymgr/control/main");
        assertEquals("OFBiz: Party Manager:", driver.getTitle());

        driver.findElement(By.name("USERNAME")).sendKeys("admin");
        driver.findElement(By.name("PASSWORD")).sendKeys("ofbiz");
        driver.findElement(By.name("loginform")).submit();

        assertTrue(driver.getPageSource().contains("THE PRIVILEGED ADMINISTRATOR"));
        assertEquals("OFBiz: Party Manager: Find Party(s)", driver.getTitle());
    }
}