O'Reilly logo

Building Applications with Scala by Diego Pacheco

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Controller tests

Now let's fix the controller tests. The first one will be the product controller.

Your ProductControllerTestSpec.scala file should look like this:

 class ProductControllerTestSpec extends PlaySpec with OneServerPerSuite with OneBrowserPerSuite with HtmlUnitFactory { "ProductController" should { DBCleaner.cleanUp() "insert a new product should be ok" in { goTo(s"http://localhost:${port}/product/add") click on id("name") enter("Blue Ball") click on id("details") enter("Blue Ball is a Awesome and simple product") click on id("price") enter("17.55") submit() } "details from the product 1 should be ok" in { goTo(s"http://localhost:${port}/product/details/1") textField("name").value mustBe "Blue Ball" textField("details").value mustBe ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required