Writing tests using Scala Play Reverse Routes

32 views
Skip to first unread message

michae...@digital.hmrc.gov.uk

unread,
Nov 17, 2015, 10:21:34 AM11/17/15
to scalatest-users
Hello,

I am writing some acceptance tests for a Scala Play application and I am not sure how to test functionality using reverse routes. 

The `call` method accepts a value of type EssentialAction, but the value of a reverse route is `Call`. 

What is the best way to call a reverse route using Scalatest?

scenario("Some scenario") {
Given("A valid header")
val request = FakeRequest().withHeaders((ACCEPT, "application/xml"))
When("the request is made with a valid foo")
val result = call(controllers.routes.MyController.get(Foo("Some string")), request) // This does not compile
Then("the status returned should be a 200")
status(result) mustEqual 200
}



Thanks

Michael

Bill Venners

unread,
Nov 17, 2015, 12:38:33 PM11/17/15
to scalate...@googlegroups.com
Hi Michael,

Did you post this question to the play mailing list? I would recommend that as it requires Play expertise more than ScalaTest expertise.

Bill

--
You received this message because you are subscribed to the Google
Groups "scalatest-users" group.
To post to this group, send email to scalate...@googlegroups.com
To unsubscribe from this group, send email to
scalatest-use...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/scalatest-users?hl=en
ScalaTest itself, and documentation, is available here:
http://www.artima.com/scalatest
---
You received this message because you are subscribed to the Google Groups "scalatest-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to scalatest-use...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.



--
Bill Venners
Artima, Inc.
http://www.artima.com
Reply all
Reply to author
Forward
0 new messages