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 extra features to avoid common issues faced by Selenium users.
FluentLenium is shipped with adapters for JUnit4, JUnit5, TestNG, Spock 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.
FluentLenium gives you multiple methods which help you write tests quicker. All those methods are tested daily by commercial regression test suites maintained by project developers.
Detailed documentation is available on fluentlenium.org.
Quickstart steps are described in detail in our separate documentation section.
Short summary:
- Add dependencies to your
pom.xml.
<properties>
<!-- Configure this property to latest available version -->
<fluentlenium.version>4.0.0</fluentlenium.version>
<!-- Make sure the selenium.version won't be overriden by another pom.xml -->
<selenium.version>3.141.59</selenium.version>
</properties>
<dependency>
<groupId>org.fluentlenium</groupId>
<artifactId>fluentlenium-junit</artifactId>
<version>4.0.0</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.fluentlenium</groupId>
<artifactId>fluentlenium-assertj</artifactId>
<version>4.0.0</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.33.3</version>
<scope>test</scope>
</dependency>- Add basic FluentLenium test
import org.fluentlenium.adapter.junit.FluentTest;
import org.fluentlenium.core.hook.wait.Wait;
import org.junit.Test;
import java.util.concurrent.TimeUnit;
import static org.assertj.core.api.Assertions.assertThat;
@Wait
public class DuckDuckGoTest extends FluentTest {
@Test
public void titleOfDuckDuckGoShouldContainSearchQueryName() {
goTo("https://duckduckgo.com");
$("#search_form_input_homepage").fill().with("FluentLenium");
$("#search_button_homepage").submit();
assertThat(window().title()).contains("FluentLenium");
}
}- Run as a JUnit test.
More detailed FluentLenium examples are available in examples section.
Examples include headless Chrome and Firefox, Spring-based framework supporting multiple browsers and much more.
If you have any comment, remark or issue, please open an issue on FluentLenium Issue Tracker