There are two different part of your application which you might want to test:
- The controller itself
- The http router
When you test the controller itself, you typically create a request and you directly pass it to a controller method, which will generate the answer. You then perform some validation of the answer to verify the test result.
When you test the router, what you want to test is that the request is routed to the right controller method: you directly call the url and you check that the result is the one you expect from the controller you expected.
What you are trying to do does not make much sense to me:
if on route /hello I have a dummyController, will my post to the route /hello works correctly?
Since the routes file is compiled into a Scala class which actually works as a router, if (and I am not sure) such a dynamic routing feature is available in play, you would have to:
- Delete the existing route on the /hello path
- Add a new route point to a different controller
- Play 2.0: FakeApplication calling a stub controller instead real one
- Play Framework, Specs2 - Calling controller method directly from unit test
- Calling Controller DBAction with scheduled Akka Runnable (in Scala / Play 2.2)
- Play Framework 2 recompiles all instead of one file
- Spying a method is calling the actual method instead of the mocked one
- How can I use Play Framework's FakeApplication to stub out calls to web services via play's WS object?
- Scala Play framework 2.5 - Elegant way to populate combobox calling a defined route or controller
- Using object SomeController extends Controller in Play framework 2.5 instead
- Why can't I have new as a method for my Users controller and routes defined in one line in play framework?
- Stub Controller in Play 2.0
- Why does one select Scala type members with a hash instead of a dot?
- One Play 2 Framework App - use both java and scala
- Calling a Scala from Java Play Framework which takes a ClassTag
- How do i use play ws library in normal sbt project instead of play?
- Why and how is Scala treating a tuple specially when calling a one arg function?
- Get form parameter value from request in Play 2.0 Scala controller
- Calling into Play framework app from the Scala console
- Play 2.0 FakeApplication setup with test configuration
- When should I use Scala's Array instead of one of the other collections?
- Where does one place a scala file in the Play Framework 2.0 so that it is compiled as part of the default package?
- How do I unit test a controller in play framework 2 scala
- In Play 2.1, What to use instead of deprecated PushEnumerator
- Play ReactiveMongo - exception when trying to find one document
- Scala Play Framework - controller as class or singleton
- Play Famework 2 - Scala - Start one application for test-suite
- Play 2 reverse routing, get route from controller method
- Play Websocket sample - Only one Akka actor?
- How i can integrate Apache Spark with the Play Framework to display predictions in real time?
- Can I use groovy templating instead of scala for Play 2.0 based Java applications?
- Play modules test & FakeApplication
More Query from same tag
- Cannot connect to Cassandra in spark-shell
- How to create stand-alone lift web application?
- Dynamically add element to map after pattern matching match case
- Need some help in fixing the Spark streaming dependency (Scala sbt)
- Load the User object on each request in a controller, how to make this object available?
- What is the difference between object A extends B and class A extends B and later new B
- How to Display form validation errors
- (JAVA) Spark SQL UDF with complex input parameter
- isin throws stackoverflow error in withcolumn function in spark
- Scala - xml transform throws away transformed elements with multiple attributes
- Unwrapping an AST
- How to interact with an FXML form in ScalaFx?
- How to convert each integers to its absolute value in Scala lists?
- there were compilation error scala spark expected class or object definition
- Scala: II have a Avro file with Body as Binary, unable to decode it to string, as I want to parse this string toJson
- Can Scala allow free Type Parameters in arguments (are Scala Type Parameters first class citizens?)?
- How to invoke Spark functions (with arguments) from applications.properties(config file)?
- Array within an array of Vectors.dense in Spark
- How to assign textfile string to dictionary value into one variable and how to extract the value by passing key in spark scala?
- spark write parquet to HDFS very slow on multi node
- Nice syntax for Validation in another monad
- what is does it mean println(_)?
- How to thread a type through wrapping classes properly?
- Modifying the default JSESSIONID cookie, Scala Lift Framework
- Circumflex orm doesn't work with Play 2.1
- How to avoid stair-stepping with Monad Transformers in scala?
- Scala: Returning a dependent type
- Basic Scala for loop Issue
- Why are these assignments to java.lang.Exception type safe?
- Using type parameters in scala