Automated UI testing in a Play Scala Application using FluentLenium

Table of contents
Reading Time: 2 minutes

In this blog I am going to demonstrate how to do Automated UI testing of a Play Scala application using FluentLenium.

FluentLenium is a framework that helps to write Selenium tests. FluentLenium provides us a fluent interface to the Selenium Web Driver. FluentLenium allows us use the assertion framework we like, either jUnit assertions or Fest-assert.

To start building testcases using FluentLenium follow the below steps:

1) Add following dependencies in build.sbt file.

2) Make an object of the page which is to be tested. For example :-

In test folder add a file IndexPage.scala of index.scala.html page & add following code to it:

This will create an Object of the Index page which can be used anywhere while making the testcases for the Application.

3) Now we can write testcases to test UI of Application. For example :-

In IntegrationTest.scala  remove anything that is written previously & add following code to test Index page in it:

For Code & Live Example click here :- FluentLenium Play Scala Example

After downloading the code just run this command :- play test

Then you can see how it runs the application on its own.

Written by 

Himanshu Gupta is a software architect having more than 9 years of experience. He is always keen to learn new technologies. He not only likes programming languages but Data Analytics too. He has sound knowledge of "Machine Learning" and "Pattern Recognition". He believes that best result comes when everyone works as a team. He likes listening to Coding ,music, watch movies, and read science fiction books in his free time.

3 thoughts on “Automated UI testing in a Play Scala Application using FluentLenium2 min read

    1. There is no specific reason to use jUnit instead of Specs2. This is just an example to show how FluentLenium works. You can use either jUnit or Specs2 for testing your application.

Comments are closed.

Discover more from Knoldus Blogs

Subscribe now to keep reading and get access to the full archive.

Continue reading