Welcome

JWebUnit is a Java-based testing framework for web applications. It wraps existing testing frameworks such as HtmlUnit and Selenium with a unified, simple testing interface to allow you to quickly test the correctness of your web applications.

What does JWebUnit provide?

JWebUnit provides a high-level Java API for navigating a web application combined with a set of assertions to verify the application's correctness. This includes navigation via links, form entry and submission, validation of table contents, and other typical business web application features.

The simple navigation methods and ready-to-use assertions allow for more rapid test creation than using only JUnit or HtmlUnit. And if you want to switch from HtmlUnit to other plugins such as Selenium (available soon), there is no need to rewrite your tests.

The current version of JWebUnit is 3.3. This is the "stable" version of JWebUnit, and requires Java 1.7.

Using JWebUnit

To use JWebUnit you only need to download the latest release JARs and include them into your project classpath. You may then test your web application by importing JWebUnit static helpers, and running these test cases with JUnit:

import org.junit.*;

import static net.sourceforge.jwebunit.junit.JWebUnit.*;

public class ExampleWebTestCase {

    @Before
    public void prepare() {
        setBaseUrl("http://localhost:8080/test");
    }

    @Test
    public void testLogin() {
        beginAt("/home");
        clickLink("login");
        assertTitleEquals("Login");
        setTextField("username", "test");
        setTextField("password", "test123");
        submit();
        assertTitleEquals("Welcome, test!");
    }
}
    
For some more examples on how to use JWebUnit in your project, please look at the quick start guide. If you are having problems with excessive Httpclient logging, you will also need to configure logback correctly.

Contributing to JWebUnit

  • To get support with using JWebUnit in your project, consider joining the JWebUnit-users mailing list.
  • If you find a bug in JWebUnit, please let us know on our bug tracker hosted on GitHub.
  • If you would like to propose a new feature or concept in the framework, please submit a pull request.

JWebUnit aims to be an active project with a vibrant community. As such we are looking for contributors, especially help in implementing other plugins such as Selenium.

JWebUnit Architecture

JWebUnit architecture