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

Related Query

More Query from same tag