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.
Is there any specific reason why you chose junit instead of specs2?
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.
Reblogged this on Play!ng with Scala and commented:
This is best implementation for testing application in Play Framework.