In this blog I am going to demonstrate how to do automated testing of UI 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.