FluentLenium helps you writing readable, reusable, reliable and resilient UI functional tests for the browser.
Java HTML Other
Latest commit 7486158 Nov 28, 2016 @Toilal Toilal Add a test for issue #425

README.md

What is FluentLenium ?

Travis Coveralls Code Climate Code Climate Issues Maven Central Website

FluentLenium helps you writing readable, reusable, reliable and resilient UI functional tests for the browser.

FluentLenium provides a Java fluent interface to Selenium, and brings some magic to avoid common issues faced by Selenium users.

FluentLenium is shipped with adapters for JUnit, TestNG and Cucumber, but it can also be used standalone.

FluentLenium best integrates with AssertJ, but you can also choose to use the assertion framework you want.

Choose the right version

FluentLenium 3.x is still in development and includes latest enhancements and features, but Selenium 3 and Java 8 are required to run it.

FluentLenium 1.x is in maintenance state, and no new feature will be added anymore. It requires Selenium 2 and Java 7, but can also be used with Java 8. Selenium 3 is not supported in this version though.

Quickstart with JUnit and AssertJ

  • Add dependencies to your pom.xml.
<dependency>
    <groupId>org.fluentlenium</groupId>
    <artifactId>fluentlenium-junit</artifactId>
    <version>3.0.4</version>
    <scope>test</scope>
</dependency>
<dependency>
    <groupId>org.fluentlenium</groupId>
    <artifactId>fluentlenium-assertj</artifactId>
    <version>3.0.4</version>
    <scope>test</scope>
</dependency>
<dependency>
    <groupId>junit</groupId>
    <artifactId>junit</artifactId>
    <version>4.12</version>
    <scope>test</scope>
</dependency>
<dependency>
    <groupId>org.seleniumhq.selenium</groupId>
    <artifactId>htmlunit-driver</artifactId>
    <version>2.23</version>
    <scope>test</scope>
</dependency>
<!-- jetty websocket is currently required by htmlunit-driver -->
<dependency>
    <groupId>org.eclipse.jetty.websocket</groupId>
    <artifactId>websocket-api</artifactId>
    <version>9.3.5.v20151012</version>
    <scope>test</scope>
</dependency>
<dependency>
    <groupId>org.eclipse.jetty.websocket</groupId>
    <artifactId>websocket-client</artifactId>
    <version>9.3.5.v20151012</version>
    <scope>test</scope>
</dependency>
<dependency>
    <groupId>xml-apis</groupId>
    <artifactId>xml-apis</artifactId>
    <version>1.4.01</version>
    <scope>test</scope>
</dependency>
  • Create a Fluent Test.
import org.fluentlenium.adapter.junit.FluentTest;
import org.fluentlenium.core.hook.wait.Wait;
import org.junit.Test;

import static org.assertj.core.api.Assertions.assertThat;

@Wait
public class DuckDuckGoTest extends FluentTest {
    @Test
    public void title_of_duck_duck_go_should_contain_search_query_name() {
        goTo("https://duckduckgo.com");
        $("#search_form_input_homepage").fill().with("FluentLenium");
        $("#search_button_homepage").submit();
        assertThat(windows().title()).contains("FluentLenium");
    }
}
  • Run as a JUnit test.

More FluentLenium examples are available on github.

 Documentation

Full documentation is available on fluentlenium.org, or in the docs sources directory.

Contact Us

If you have any comment, remark or issue, please open an issue on FluentLenium Issue Tracker