We did unit tests, we did route tests, and now is the time to add controller tests. Controller tests are similar to routes tests, but they are not the same. For instance, our controller always respond to UI pages, so we expected to create specific HTML pages based on each method. The Play framework has integration with Selenium, which is a testing framework for UIs, and a controllers that allows you to simulate web browsers, and you can do pretty much the same as you would by clicking on the pages like a real user.
So let's get started. First, we will start with RndDoubleGeneratorControllerTestSpec
.
The RndDoubleGeneratorControllerTestSpec.scala
file should contain the following code:
class RndDoubleGeneratorControllerTestSpec extends PlaySpec with OneServerPerSuite with OneBrowserPerSuite with HtmlUnitFactory { val injector = new GuiceApplicationBuilder...